65 #define P_32 0xEDB88320L
66 #define P_CCITT 0x1021
68 #define P_KERMIT 0x8408
133 unsigned short tmp, short_c;
135 short_c = 0x00ff & (
unsigned short) c;
139 tmp = (crc >> 8) ^ short_c;
161 unsigned short short_c, short_p;
163 short_c = 0x00ff & (
unsigned short) c;
164 short_p = (
unsigned short)(( 0x00ff & (
unsigned short) prev_byte ) << 8);
166 if ( crc & 0x8000 ) crc = (
unsigned short)(( crc << 1 ) ^
P_SICK);
167 else crc = (
unsigned short)(crc << 1);
170 crc ^= ( short_c | short_p );
190 unsigned short tmp, short_c;
192 short_c = 0x00ff & (
unsigned short) c;
199 crc = (crc >> 8) ^
crc_tab16[ (
unsigned int)(tmp & 0xff) ];
219 unsigned short tmp, short_c;
221 short_c = 0x00ff & (
unsigned short) c;
246 unsigned short tmp, short_c;
248 short_c = 0x00ff & (
unsigned short) c;
273 unsigned long tmp, long_c;
275 long_c = 0x000000ffL & (
unsigned long) c;
280 crc = (crc >> 8) ^
crc_tab32[ tmp & 0xff ];
300 unsigned short crc, c;
302 for (i=0; i<256; i++) {
305 c = (
unsigned short) i;
307 for (j=0; j<8; j++) {
309 if ( (crc ^ c) & 0x0001 ) crc = ( crc >> 1 ) ^
P_16;
336 unsigned short crc, c;
338 for (i=0; i<256; i++) {
341 c = (
unsigned short) i;
343 for (j=0; j<8; j++) {
345 if ( (crc ^ c) & 0x0001 ) crc = ( crc >> 1 ) ^
P_KERMIT;
372 unsigned short crc, c;
374 for (i=0; i<256; i++) {
377 c = (
unsigned short) i;
379 for (j=0; j<8; j++) {
381 if ( (crc ^ c) & 0x0001 ) crc = ( crc >> 1 ) ^
P_DNP;
410 for (i=0; i<256; i++) {
412 crc = (
unsigned long) i;
414 for (j=0; j<8; j++) {
416 if ( crc & 0x00000001L ) crc = ( crc >> 1 ) ^
P_32;
441 unsigned short crc, c;
443 for (i=0; i<256; i++) {
446 c = (
unsigned short)(((
unsigned short) i) << 8);
448 for (j=0; j<8; j++) {
450 if ( (crc ^ c) & 0x8000 ) crc = (
unsigned short)(( crc << 1 ) ^
P_CCITT);
451 else crc = (
unsigned short)(crc << 1);
453 c = (
unsigned short)(c << 1);
unsigned short update_crc_ccitt(unsigned short crc, char c)
unsigned short update_crc_kermit(unsigned short crc, char c)
static void init_crcdnp_tab(void)
static void init_crc32_tab(void)
unsigned short update_crc_sick(unsigned short crc, char c, char prev_byte)
unsigned long update_crc_32(unsigned long crc, char c)
static void init_crcccitt_tab(void)
unsigned short update_crc_dnp(unsigned short crc, char c)
unsigned short update_crc_16(unsigned short crc, char c)
static unsigned short crc_tabdnp[256]
static void init_crc16_tab(void)
static int crc_tab16_init
static void init_crckermit_tab(void)
static int crc_tab32_init
static unsigned short crc_tab16[256]
static int crc_tabccitt_init
static unsigned long crc_tab32[256]
static int crc_tabdnp_init
static int crc_tabkermit_init
static unsigned short crc_tabkermit[256]
static unsigned short crc_tabccitt[256]