65#define P_32 0xEDB88320L
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;
197 crc = (crc >> 8) ^
crc_tab16[ tmp & 0xff ];
217 unsigned short tmp, short_c;
219 short_c = 0x00ff & (
unsigned short) c;
244 unsigned short tmp, short_c;
246 short_c = 0x00ff & (
unsigned short) c;
271 unsigned long tmp, long_c;
273 long_c = 0x000000ffL & (
unsigned long) c;
278 crc = (crc >> 8) ^
crc_tab32[ tmp & 0xff ];
298 unsigned short crc, c;
300 for (i=0; i<256; i++) {
303 c = (
unsigned short) i;
305 for (j=0; j<8; j++) {
307 if ( (crc ^ c) & 0x0001 ) crc = ( crc >> 1 ) ^
P_16;
334 unsigned short crc, c;
336 for (i=0; i<256; i++) {
339 c = (
unsigned short) i;
341 for (j=0; j<8; j++) {
343 if ( (crc ^ c) & 0x0001 ) crc = ( crc >> 1 ) ^
P_KERMIT;
370 unsigned short crc, c;
372 for (i=0; i<256; i++) {
375 c = (
unsigned short) i;
377 for (j=0; j<8; j++) {
379 if ( (crc ^ c) & 0x0001 ) crc = ( crc >> 1 ) ^
P_DNP;
408 for (i=0; i<256; i++) {
410 crc = (
unsigned long) i;
412 for (j=0; j<8; j++) {
414 if ( crc & 0x00000001L ) crc = ( crc >> 1 ) ^
P_32;
439 unsigned short crc, c;
441 for (i=0; i<256; i++) {
444 c = (
unsigned short)(((
unsigned short) i) << 8);
446 for (j=0; j<8; j++) {
448 if ( (crc ^ c) & 0x8000 ) crc = (
unsigned short)(( crc << 1 ) ^
P_CCITT);
449 else crc = (
unsigned short)(crc << 1);
451 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]