[原创软件模块]crc32 BUG修复 uint16_t改为 uint32_t
uint32_t crc32(uint8_t *data, uint32_t length){
uint8_t i;
uint32_t crc = 0xffffffff; // Initial value
while(length--)
{
crc ^= *data++; // crc ^= *data; data++;
for (i = 0; i < 8; ++i)
{
if (crc & 1)
crc = (crc >> 1) ^ 0xEDB88320;// 0xEDB88320= reverse 0x04C11DB7
else
crc = (crc >> 1);
}
}
return ~crc;
}uint32_t crc32(uint8_t *data, uint32_t length);
感谢大佬分享
页:
[1]