为了提高编码效率,在实际运用中大多采用查表法来完成CRC-32校验,下面是产生CRC-32校验吗的子程序。
    unsigned long  crc_32_tab[256]={
    0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,0x0edb8832,…, 0x5a05df1b, 0x2d02ef8d
    };//事先计算出的参数表,共有256项,未全部列出。
    unsigned long GenerateCRC32(char xdata * DataBuf,unsigned long  len)
    {
       unsigned long oldcrc32;
       unsigned long crc32;
       unsigned long oldcrc;
       unsigned  int charcnt;
            char c,t;
       oldcrc32 = 0x00000000; //初值为0
        charcnt=0;
       while (len--) {
                    t= (oldcrc32 >> 24) & 0xFF;   //要移出的字节的值--〉不明白,为什么这么做就能得出要移出的字节的值?       oldcrc=crc_32_tab[t];         //根据移出的字节的值查表
                    c=DataBuf[charcnt];          //新移进来的字节值
                    oldcrc32= (oldcrc32 << 8) | c;   //将新移进来的字节值添在寄存器末字节中
                    oldcrc32=oldcrc32^oldcrc;     //将寄存器与查出的值进行xor运算
                    charcnt++;
       }
            crc32=oldcrc32;
            return crc32;
    }红色部分就是我的疑问,请大虾们给小弟解惑啊。谢谢了