标题: 生成CRC校验4bit的查找表程序问题 [打印本页]

作者: 星际漫游者    时间: 2017-9-27 16:37
标题: 生成CRC校验4bit的查找表程序问题
#define LUT_WIDTH   4#define CRC_WIDTH   8#define CRC_POLY    0x11Cfor(index=0; index<(1<<LUT_WIDTH); index++){    temp = 0;    for(bit_cnt=LUT_WIDTH; bit_cnt>0; bit_cnt--){        if((index>>(bit_cnt-1) ^ temp>>(CRC_WIDTH-1))&0x1)            temp = (temp<<1) ^ CRC_POLY;        else                                                             temp <<= 1;    }    table[index] = (unsigned char)temp; }发现网上好多CRC校验生成表程序都是这样的,红色部分难道就没有问题吗?
还是说这个程序不是C语言中的程序




作者: 星际漫游者    时间: 2017-9-27 16:38
上面程序不好看到




欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1