AmendHub

Download:

jcs

/

subtext

/

amendments

/

198

crc: Add explicit casting to UpdateCRC like UpdateCRC32


jcs made amendment 198 about 1 year ago
--- crc.h Wed Jul 6 17:18:09 2022 +++ crc.h Sat Jul 9 22:40:27 2022 @@ -8,7 +8,8 @@ extern const unsigned short crc16_table[]; extern const unsigned long crc32_table[]; -#define UpdateCRC(b, c) (crc16_table[((c >> 8) & 0xff) ^ (unsigned char)b] ^ (c << 8)) +#define UpdateCRC(b, c) (crc16_table[(((unsigned short)c >> 8) & 0xff) ^ \ + (unsigned short)(b)] ^ ((unsigned short)c << 8)) #define UpdateCRC32(b, c) (crc32_table[((unsigned long)c ^ \ (unsigned short)(b)) & 0xff] ^ (unsigned long)((unsigned long)c >> 8))