MCPcopy Create free account
hub / github.com/BernardoGiordano/Checkpoint / initCrc

Function initCrc

common/transferprotocol.cpp:64–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62 bool crcInit = false;
63
64 void initCrc(void)
65 {
66 if (crcInit) {
67 return;
68 }
69 for (uint32_t i = 0; i < 256; ++i) {
70 uint32_t c = i;
71 for (int j = 0; j < 8; ++j) {
72 c = (c & 1) ? (0xEDB88320u ^ (c >> 1)) : (c >> 1);
73 }
74 crcTable[0][i] = c;
75 }
76 for (uint32_t i = 0; i < 256; ++i) {
77 uint32_t c = crcTable[0][i];
78 for (int t = 1; t < 8; ++t) {
79 c = crcTable[0][c & 0xFFu] ^ (c >> 8);
80 crcTable[t][i] = c;
81 }
82 }
83 crcInit = true;
84 }
85 }
86
87 // Slicing-by-8 CRC32: 8 bytes per iteration instead of 1. On the 268MHz

Callers 1

updateCrcFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected