|
int main()
{
/**//// the data
unsigned long data = 0x1011035b;
/**//// load the register with the data
unsigned long regi = 0;
/**//// allocate memory to contain the data
unsigned char p[4];
/**//// copy data
memcpy( p, &data, 4 );
/**//// the table
unsigned long table[256];
/**//// create the table
create_table( table );
/**//// because data contains 4 bytes
for( int i = 0; i < 4; ++ i )
{
regi = ( regi << 8 ) ^ table[ ( regi >> 24 ) ^ p[i] ];
}
/**//// and now, register contains the remainder which is also called CRC value.
return 0;
}
、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、
regi = ( regi << 8 ) ^ table[ ( regi >> 24 ) ^ p[i] ;这句话就是推倒不出来了,大侠们帮分析一下。 |
阿莫论坛20周年了!感谢大家的支持与爱护!!
知道什么是神吗?其实神本来也是人,只不过神做了人做不到的事情 所以才成了神。 (头文字D, 杜汶泽)
|