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

Function updateCrc

common/transferprotocol.cpp:43–58  ·  view source on GitHub ↗

Hardware CRC32 on ARMv8. devkitA64 builds with -march=armv8-a+crc, so the checksum is effectively free instead of a bytewise table loop.

Source from the content-addressed store, hash-verified

41 // Hardware CRC32 on ARMv8. devkitA64 builds with -march=armv8-a+crc, so the
42 // checksum is effectively free instead of a bytewise table loop.
43 uint32_t updateCrc(uint32_t crc, const uint8_t* data, size_t len)
44 {
45 uint32_t c = crc;
46 while (len >= 8) {
47 uint64_t v;
48 std::memcpy(&v, data, 8);
49 c = __crc32d(c, v);
50 data += 8;
51 len -= 8;
52 }
53 while (len > 0) {
54 c = __crc32b(c, *data++);
55 len--;
56 }
57 return c;
58 }
59#else
60 namespace {
61 uint32_t crcTable[8][256];

Callers 2

extractZipFunction · 0.70
sendZipStreamFunction · 0.70

Calls 1

initCrcFunction · 0.85

Tested by

no test coverage detected