#include <crc32c.h>
This class implements a CRC32C generator which is based on the generator polynom x^32+x^28+x^27+x^26+x^25+x^23+x^22+x^20+x^19+x^18+x^14+x^13+x^11+x^10+x^9+x^8+x^6+1 0x11EDC6F41 (the iSCSI CRC). If available the SSE4.2 instructions are used, otherwise it will be calculated by software. The returned CRC value is equal for all machines. All these examples should deliver the same result per line (0xcdee067a) on all systems: UpdateUInt64(0x1234567890abcdef) UpdateUInt32(0x90abcdef) UpdateUInt32(0x12345678) UpdateUInt16(0xcdef) UpdateUInt32(0x567890ab) UpdateUInt16(0x1234) UpdateUChar(0xef) UpdateUChar(0xcd) UpdateUInt32(0x567890ab) UpdateUChar(0x34) UpdateUChar(0x12) UInt64 val = 0x1234567890abcdef Update(&val, 8) see http://drdobbs.com/cpp/229401411 and http://download.intel.com/design/intarch/papers/323405.pdf for a parallelized CRC
Static Public Member Functions | |
static constexpr UInt32 | GetResetValue () |
Static Public Attributes | |
static const UInt32 | UNSET_VALUE |
Protected Attributes | |
UInt32 | _crc |
Static Protected Attributes | |
static const UInt32 | crc32tab_o32 [256] |
static const UInt32 | crc32tab_o40 [256] |
static const UInt32 | crc32tab_o48 [256] |
static const UInt32 | crc32tab_o56 [256] |
static const UInt32 | crc32tab_o64 [256] |
static const UInt32 | crc32tab_o72 [256] |
static const UInt32 | crc32tab_o80 [256] |
static const UInt32 | crc32tab_o88 [256] |
static const UInt32 | RESET_VALUE |
Friends | |
Bool | operator== (const Crc32C &a, const Crc32C &b) |
Bool | operator!= (const Crc32C &a, const Crc32C &b) |
Crc32C | ( | ) |
Constructs the object and resets its state.
Constructs the object and sets its state to a certain value.
[in] | u | The initial value. |
UInt32 GetCrc | ( | ) | const |
Gets the CRC value.
void Reset | ( | ) |
Resets the state of this instance.
void Set | ( | UInt32 | u | ) |
Constructs the objects and resets its state.
[in] | u | The new state value. |
Assigns another value.
[in] | other | The new value. |
|
staticconstexpr |
Gets the internal value of a reset class.
MAXON_ATTRIBUTE_FORCE_INLINE void UpdateUInt64 | ( | UInt64 | u | ) |
Accumulates the CRC value.
[in] | u | The value used to accumulate the CRC value. |
MAXON_ATTRIBUTE_FORCE_INLINE void UpdateUInt32 | ( | UInt32 | u | ) |
Accumulates the CRC value.
[in] | u | The value used to accumulate the CRC value. |
MAXON_ATTRIBUTE_FORCE_INLINE void UpdateUInt16 | ( | UInt16 | u | ) |
Accumulates the CRC value.
[in] | u | The value used to accumulate the CRC value. |
MAXON_ATTRIBUTE_FORCE_INLINE void UpdateUChar | ( | UChar | u | ) |
Accumulates the CRC value.
[in] | u | The value used to accumulate the CRC value. |
MAXON_ATTRIBUTE_FORCE_INLINE void Update | ( | const Block< const Byte > & | mem | ) |
Accumulates the CRC value.
[in] | mem | A raw memory buffer. |
MAXON_ATTRIBUTE_FORCE_INLINE void Update | ( | const Block< const Byte > & | mem | ) |
Accumulates the CRC value.
ALIGNMENT | Alignment hint. Must be a power of 2. |
[in] | mem | A raw memory buffer. |
MAXON_ATTRIBUTE_FORCE_INLINE void UpdateUInt | ( | UInt | u | ) |
Accumulates the CRC value.
[in] | u | The value used to accumulate the CRC value. |
MAXON_ATTRIBUTE_FORCE_INLINE void UpdateInt64 | ( | Int64 | i | ) |
Accumulates the CRC value.
[in] | i | The value used to accumulate the CRC value. |
MAXON_ATTRIBUTE_FORCE_INLINE void UpdateInt32 | ( | Int32 | i | ) |
Accumulates the CRC value.
[in] | i | The value used to accumulate the CRC value. |
MAXON_ATTRIBUTE_FORCE_INLINE void UpdateInt16 | ( | Int16 | i | ) |
Accumulates the CRC value.
[in] | i | The value used to accumulate the CRC value. |
MAXON_ATTRIBUTE_FORCE_INLINE void UpdateInt | ( | Int | i | ) |
Accumulates the CRC value.
[in] | i | The value used to accumulate the CRC value. |
MAXON_ATTRIBUTE_FORCE_INLINE void UpdateChar | ( | Char | i | ) |
Accumulates the CRC value.
[in] | i | The value used to accumulate the CRC value. |
MAXON_ATTRIBUTE_FORCE_INLINE void UpdateBool | ( | Bool | b | ) |
Accumulates the CRC value.
[in] | b | The value used to accumulate the CRC value. |
MAXON_ATTRIBUTE_FORCE_INLINE void UpdateFloat32 | ( | Float32 | r | ) |
Accumulates the CRC value.
[in] | r | The value used to accumulate the CRC value. |
MAXON_ATTRIBUTE_FORCE_INLINE void UpdateFloat64 | ( | Float64 | r | ) |
Accumulates the CRC value.
[in] | r | The value used to accumulate the CRC value. |
MAXON_ATTRIBUTE_FORCE_INLINE void UpdateFloat | ( | Float | r | ) |
Accumulates the CRC value.
[in] | r | The value used to accumulate the CRC value. |
MAXON_ATTRIBUTE_FORCE_INLINE void UpdateVector2d32 | ( | const Vector2d32 & | r | ) |
Accumulates the CRC value.
[in] | r | The value used to accumulate the CRC value. |
MAXON_ATTRIBUTE_FORCE_INLINE void UpdateVector32 | ( | const Vector32 & | r | ) |
Accumulates the CRC value.
[in] | r | The value used to accumulate the CRC value. |
MAXON_ATTRIBUTE_FORCE_INLINE void UpdateVector4d32 | ( | const Vector4d32 & | r | ) |
Accumulates the CRC value.
[in] | r | The value used to accumulate the CRC value. |
MAXON_ATTRIBUTE_FORCE_INLINE void UpdateVector2d64 | ( | const Vector2d64 & | r | ) |
Accumulates the CRC value.
[in] | r | The value used to accumulate the CRC value. |
MAXON_ATTRIBUTE_FORCE_INLINE void UpdateVector64 | ( | const Vector64 & | r | ) |
Accumulates the CRC value.
[in] | r | The value used to accumulate the CRC value. |
MAXON_ATTRIBUTE_FORCE_INLINE void UpdateVector4d64 | ( | const Vector4d64 & | r | ) |
Accumulates the CRC value.
[in] | r | The value used to accumulate the CRC value. |
MAXON_ATTRIBUTE_FORCE_INLINE void UpdateVector2d | ( | const Vector2d & | r | ) |
Accumulates the CRC value.
[in] | r | The value used to accumulate the CRC value. |
MAXON_ATTRIBUTE_FORCE_INLINE void UpdateVector | ( | const Vector & | r | ) |
Accumulates the CRC value.
[in] | r | The value used to accumulate the CRC value. |
MAXON_ATTRIBUTE_FORCE_INLINE void UpdateVector4d | ( | const Vector4d & | r | ) |
Accumulates the CRC value.
[in] | r | The value used to accumulate the CRC value. |
MAXON_ATTRIBUTE_FORCE_INLINE void UpdatePointer | ( | const void * | p | ) |
Accumulates the CRC value.
[in] | p | The value used to accumulate the CRC value. |
Checks for equality.
[in] | a | First operand. |
[in] | b | Second operand. |
Checks for inequality.
[in] | a | First operand. |
[in] | b | Second operand. |
|
protected |
The CRC value that is accumulated.
|
staticprotected |
A helper table for the software CRC.
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
static |
Crc is most liekly unset if GetCrc returns UNSET_VALUE.