CRC网站
CRC16-CCITT
word CRC_16_CCITT(byte data[], byte len)
{
stack int i = 0;
stack int index = 0;
word crc16 = 0x0000;
while(len--)
{
for(i=0x80; i!=0; i>>=1)
{
if((crc16 & 0x8000) != 0) {
crc16 = crc16 << 1;
crc16 = crc16 ^ 0x1021;
}
else{
crc16 = crc16 << 1;
}
if((data[index] & i) != 0) {
crc16 = crc16 ^ 0x1021; //crc16 = crc16 ^ (0x10000 ^ 0x11021)
}
}
index++;
}
return crc16;
}
标签:crc16,int,len,Capl,CRC,byte,大全 From: https://www.cnblogs.com/YiMo9929/p/18128657