mirror of https://github.com/tongzx/nt5src
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.4 KiB
43 lines
1.4 KiB
//------------------------------------------------------------------------
|
|
// Copyright (C) Sewell Development Corporation, 1994 - 1998.
|
|
// Web: www.sewelld.com E-mail: [email protected]
|
|
//
|
|
// LICENSE: This source code was generated by CrcGen, a product of Sewell
|
|
// Development Corporation. Paid-up licensees of CrcGen are authorized to
|
|
// use this code on a site-wide basis without restriction as to
|
|
// the type of product it is incorporated in, except that it may not be
|
|
// resold as stand-alone CRC code, and the copyright notice and license
|
|
// agreement must not be removed from the code.
|
|
//------------------------------------------------------------------------
|
|
|
|
// Interface definition for 32-bit CRC (cyclic redundancy check) class:
|
|
// Polynomial: 04C11DB7
|
|
// Initial CRC register value: FFFFFFFF
|
|
// Reflected input and output: Yes
|
|
// Inverted final output: Yes
|
|
// CRC of string "123456789": CBF43926
|
|
|
|
class Crc32 {
|
|
public:
|
|
explicit
|
|
Crc32() {
|
|
m_crc = 0xFFFFFFFF;
|
|
}
|
|
explicit
|
|
Crc32(unsigned __int32 uiInitialCrc) {
|
|
m_crc = uiInitialCrc;
|
|
}
|
|
Crc32(const void* buffer, unsigned int count) {
|
|
m_crc = 0xFFFFFFFF;
|
|
Compute(buffer, count);
|
|
}
|
|
void Compute(const void* buffer, unsigned int count);
|
|
void Compute(unsigned char value);
|
|
operator unsigned __int32 () const {
|
|
return m_crc ^ 0xFFFFFFFF;
|
|
}
|
|
|
|
private:
|
|
unsigned __int32 m_crc;
|
|
};
|
|
|