16#pragma comment(user,"T-Coverage Disable")
55 WORD
CalcTb1(
size_t size,
const void* P, WORD r = 0xFFFF)
58 const BYTE* B =
static_cast<const BYTE*
>(P);
61 r =
static_cast<WORD
>((r <<
BYTE_BIT) ^ m_table1[BYTE((r >> (16 -
BYTE_BIT)) ^ *B++)]);
63 return static_cast<WORD
>(~r);
73 static WORD
Calc1(
size_t size,
const void* P, WORD r = 0xFFFF)
75 const BYTE* B =
static_cast<const BYTE*
>(P);
81 r =
static_cast<WORD
>(((r & 0x8000) != 0) ? ((r << 1) ^
CRCPOLY1) : (r << 1));
84 return static_cast<WORD
>(~r);
94 WORD
CalcTb2(
size_t size,
const void* P, WORD r = 0xFFFF)
97 const BYTE* B =
static_cast<const BYTE*
>(P);
100 r =
static_cast<WORD
>((r >>
BYTE_BIT) ^ m_table2[BYTE(r ^ *B++)]);
102 return static_cast<WORD
>(r ^ 0xFFFF);
112 static WORD
Calc2(
size_t size,
const void* P, WORD r = 0xFFFF)
114 const BYTE* B =
static_cast<const BYTE*
>(P);
120 r =
static_cast<WORD
>(((r & 1) != 0) ? ((r >> 1) ^
CRCPOLY2) : (r >> 1));
123 return static_cast<WORD
>(r ^ 0xFFFF);
128 void m_InitTable1(
void)
135 WORD r =
static_cast<WORD
>(i << (16 -
BYTE_BIT));
138 r =
static_cast<WORD
>(((r & 0x8000) != 0) ? ((r << 1) ^
CRCPOLY1) : (r << 1));
145 void m_InitTable2(
void)
152 WORD r =
static_cast<WORD
>(i);
155 r =
static_cast<WORD
>(((r & 1) != 0) ? ((r >> 1) ^
CRCPOLY2) : (r >> 1));
187 static WORD
Calc1(
size_t size,
const void* P)
189 return ms_Calc(size, P, 0xA001);
198 static WORD
Calc2(
size_t size,
const void* P)
200 return ms_Calc(size, P, 0x8005);
205 static WORD ms_Calc(
size_t size,
const void* P, WORD r)
208 const BYTE* B =
static_cast<const BYTE*
>(P);
214 crc =
static_cast<WORD
>(((b ^
static_cast<BYTE
>(crc)) & 1) ? ((crc >> 1) ^ r) : (crc >> 1));
246 return CalcTb(0xffffffffL, size, p) ^ 0xffffffffL;
256 DWORD
CalcTb(DWORD crc,
size_t size,
const void* p)
258 const BYTE *b =
static_cast<const BYTE*
>(p);
263 c = m_table[(c ^ b[n]) & 0xff] ^ (c >> 8);
270 void m_InitTable(
void)
277 DWORD c =
static_cast<DWORD
>(n);
282 c = 0xedb88320L ^ (c >> 1);
303#pragma comment(user,"T-Coverage Enable")
#define loop(VAR, CNT)
loop構文.
CRC-16-IBM(Cyclic Redundancy Check 16bit)計算クラス.
static WORD Calc1(size_t size, const void *P)
[計算] 計算(0xA001)
static WORD Calc2(size_t size, const void *P)
[計算] 計算(0x8005)
CRC-16-CCITT(Cyclic Redundancy Check 16bit)計算クラス.
static WORD Calc2(size_t size, const void *P, WORD r=0xFFFF)
[計算] 計算(LSBファースト)
static WORD Calc1(size_t size, const void *P, WORD r=0xFFFF)
[計算] 計算(MSBファースト)
WORD CalcTb2(size_t size, const void *P, WORD r=0xFFFF)
[計算] テーブル計算(LSBファースト)
WORD CalcTb1(size_t size, const void *P, WORD r=0xFFFF)
[計算] テーブル計算(MSBファースト)
CRC32(Cyclic Redundancy Check 32bit)計算クラス.
DWORD CalcTb(size_t size, const void *p)
[計算] テーブル計算
DWORD CalcTb(DWORD crc, size_t size, const void *p)
[計算] テーブル計算
size_t GetSize(void) const
[取得] サイズ取得
void Resize(size_t l)
[設定] サイズ再設定