No.5506 作者:mypatrick 邮件:xulin1978@163.net ID:5318 登陆:1次 文章数:1篇 最后登陆IP: 最后登陆:2002/2/2 14:41:00 注册:2002/2/2 14:41:00 财富:6 发帖时间:2002/2/2 14:46:00 发贴者IP:202.119.80.20 标题:mypatrick:C51编程:CRC编程求助 摘要:No.5506C51编程:CRC编程求助 我在看一个CRC-16的校验和生成程序,感觉有的地方不大理解。 代码如下: buf 为字节序列, len: 序列长度 返回该序列的CRC_16校验码 多项式: x^16+x^15+x^2+1 unsigned int CRC_16(unsigned char *buf,unsigned int len) { unsigned short crc=0; unsigned short c,i; while(len!=0) { c=*buf; c<<=8; for(i=0;i<8;i++) { if((crc^c)&0x8000) crc=(crc<<1)^0x800 ......
>>返回讨论的主题
|
老古网执行:16毫秒 最大:2531毫秒 查询6次
|
|