MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / crc32Ref

Function crc32Ref

source/MRTest/MRZlibTests.cpp:10–20  ·  view source on GitHub ↗

independent CRC-32 reference (PKZIP polynomial 0xedb88320, init 0xffffffff, final xor 0xffffffff)

Source from the content-addressed store, hash-verified

8
9/// independent CRC-32 reference (PKZIP polynomial 0xedb88320, init 0xffffffff, final xor 0xffffffff)
10uint32_t crc32Ref( const unsigned char* data, size_t len )
11{
12 uint32_t crc = 0xffffffffu;
13 for ( size_t i = 0; i < len; ++i )
14 {
15 crc ^= data[i];
16 for ( int k = 0; k < 8; ++k )
17 crc = ( crc & 1u ) ? ( crc >> 1 ) ^ 0xedb88320u : ( crc >> 1 );
18 }
19 return ~crc;
20}
21
22constexpr unsigned char cInput[] = {
23 0xe1, 0x83, 0x9b, 0xe1, 0x83, 0x94, 0xe1, 0x83, 0xaa, 0xe1, 0x83, 0xae,

Callers 1

TESTFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected