From 1353c97bde48287212699eb5b1e0cea8cfca86d6 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 2 Sep 2024 21:06:01 +0200 Subject: [PATCH] radiotools.cpp: Don't use register keyword with C++17 standard Conditionally use register keyword for backward compatibility; remove for C++17 and later where it is not allowed. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/c72cdb861266f98f029c1818df91d0acfa7c3958 Author: Thilo Graf Date: 2024-09-02 (Mon, 02 Sep 2024) ------------------ This commit was generated by Migit --- src/driver/radiotools.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/driver/radiotools.cpp b/src/driver/radiotools.cpp index f0be42bc9..4b70cc8e8 100644 --- a/src/driver/radiotools.cpp +++ b/src/driver/radiotools.cpp @@ -28,7 +28,11 @@ unsigned short crc16_ccitt(unsigned char *daten, int len, bool skipfirst) { - register unsigned short crc = 0xffff; +#if __cplusplus < 201703L + register unsigned short crc = 0xffff; // Use register for older standards +#else + unsigned short crc = 0xffff; // register keyword is not allowed in C++17 and later +#endif if (skipfirst) daten++; while (len--) { @@ -39,7 +43,7 @@ unsigned short crc16_ccitt(unsigned char *daten, int len, bool skipfirst) crc ^= ((crc & 0xff) << 4) << 1; } - return ~(crc); + return ~(crc); } char *rtrim(char *text)