From f07963e802328bcd02c688d1ed7f652638e22804 Mon Sep 17 00:00:00 2001 From: folkert van heusden Date: Tue, 24 Jan 2023 21:30:16 +0100 Subject: [PATCH] Small tweak that reduces the number of lines of code in XModemAdapter::check to 1. It should be functionally the same. --- src/xmodem.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/xmodem.cpp b/src/xmodem.cpp index 473635e67..f8b5084dc 100644 --- a/src/xmodem.cpp +++ b/src/xmodem.cpp @@ -54,11 +54,7 @@ unsigned short XModemAdapter::crc16_ccitt(const pb_byte_t *buffer, int length) int XModemAdapter::check(const pb_byte_t *buf, int sz, unsigned short tcrc) { - unsigned short crc = crc16_ccitt(buf, sz); - if (crc == tcrc) - return 1; - else - return 0; + return crc16_ccitt(buf, sz) == tcrc; } void XModemAdapter::sendControl(meshtastic_XModem_Control c)