📄 crc.cpp
字号:
/**
@file
Implements the Crc class.
*/
#include <cassert>
#include "Crc.h"
void Crc::Init()
{
assert(_key!=0);
//for all possible byte values
for (unsigned int i=0; i<256; i++)
{
Crc::Type reg= i<<24;
// for all bits in a byte
for(int j=0; j<8; j++)
{
bool topBit= (reg & 0x80000000) != 0;
reg <<= 1;
if(topBit)
reg ^= _key;
}
_table[i] = reg;
}
}
void Crc::Put32Bit(unsigned t)
{
PutByte((t & 0xff000000)>>24);
PutByte((t & 0x00ff0000)>>16);
PutByte((t & 0x0000ff00)>>8);
PutByte((t & 0x000000ff));
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -