Hardware CRC32 on ARMv8. devkitA64 builds with -march=armv8-a+crc, so the checksum is effectively free instead of a bytewise table loop.
| 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]; |
no test coverage detected