AmendHub

Download

jcs

/

subtext

/

crc.h

 

(View History)

jcs   crc: Add explicit casting to UpdateCRC like UpdateCRC32 Latest amendment: 198 on 2022-07-12

1 /* Public domain */
2
3 #ifndef __CRC_H__
4 #define __CRC_H__
5
6 #if THINK_C
7
8 extern const unsigned short crc16_table[];
9 extern const unsigned long crc32_table[];
10
11 #define UpdateCRC(b, c) (crc16_table[(((unsigned short)c >> 8) & 0xff) ^ \
12 (unsigned short)(b)] ^ ((unsigned short)c << 8))
13 #define UpdateCRC32(b, c) (crc32_table[((unsigned long)c ^ \
14 (unsigned short)(b)) & 0xff] ^ (unsigned long)((unsigned long)c >> 8))
15
16 #else
17
18 unsigned short UpdateCRC(unsigned char b, unsigned short crc);
19 unsigned long UpdateCRC32(unsigned char b, unsigned long crc);
20
21 #endif
22
23 #endif /* __CRC_H__ */