20 static const unsigned long POLYNOMIAL = 0x04c11db7UL;
22 for (
unsigned long i = 0; i < 256; ++i ) {
23 unsigned long crc = i << 24;
24 for (
int j = 0; j < 8; j++ ) {
25 if ( crc & 0x80000000UL ) {
26 crc = ( ( crc << 1 ) ^ POLYNOMIAL ) & 0xffffffffUL;
28 crc = ( crc << 1 ) & 0xffffffffUL;
31 crc_table.push_back(crc);
38 unsigned long crc = 0;
40 for (
int j = 0; j != end; ++j) {
41 int i = ( (
int) ( crc >> 24) ^ s[j] ) & 0xff;
42 crc = ( ( crc << 8 ) ^ crc_table[i] ) & 0xffffffffUL;