CRC的余数计算看懂了,但参数表的看不理解
#include <stdio.h>
unsigned long int crc32_table[256];
unsigned long int ulPolynomial = 0x04c11db7;
unsigned long int Reflect(unsigned long int ref, char ch){
unsigned long int value=0;
int i;
for(i = 1; i < (ch + 1); i++){
if(ref & 1)
value |= 1 << (ch - i);
ref >>= 1;
}
return value;
}
void init_crc32_table(){
unsigned long int crc,temp;
unsigned long int t1,t2;
unsigned long int flag;
int i,j;
for(i = 0; i <= 0xFF; i++){
temp=Reflect(i, 8);
crc32_table[i]= temp<< 24;
for (j = 0; j < 8; j++){
flag=crc32_table[i]&0x80000000;
t1=(crc32_table[i] << 1);
if(flag==0)
t2=0;
else
t2=ulPolynomial;
crc32_table[i] =t1^t2 ;
}
crc=crc32_table[i];
crc32_table[i] = Reflect(crc32_table[i], 32);
}
return;
}
[此贴子已经被作者于2006-11-21 19:16:22编辑过]