10 static const UInt16 kCRCPoly = 0xA001;
12 UInt16 CCRC::Table[256];
14 void CCRC::InitTable()
16 for (UInt32 i = 0; i < 256; i++)
19 for (int j = 0; j < 8; j++)
21 r = (r >> 1) ^ kCRCPoly;
24 CCRC::Table[i] = (UInt16)r;
31 CCRCTableInit() { CCRC::InitTable(); }
34 void CCRC::Update(const void *data, size_t size)
37 const Byte *p = (const Byte *)data;
38 for (; size > 0; size--, p++)
39 v = (UInt16)(Table[((Byte)(v)) ^ *p] ^ (v >> 8));