Mercurial > crc32
comparison crc32c.c @ 3:6483683ac857 default tip
*: add profiling code too; expand x86 to use all eight XMM registers
basically ported verbatim from the assembly
| author | Paper <paper@tflc.us> |
|---|---|
| date | Mon, 09 Feb 2026 21:30:30 -0500 |
| parents | 422835bc1aca |
| children |
comparison
equal
deleted
inserted
replaced
| 2:ead9f84d11db | 3:6483683ac857 |
|---|---|
| 1 #include "crc32i.h" | 1 #include "crc32i.h" |
| 2 | 2 |
| 3 uint32_t crc32c_r(uint32_t crc, const unsigned char *message, size_t sz) | 3 uint32_t crc32c_r(uint32_t crc, const unsigned char *message, size_t sz) |
| 4 { | 4 { |
| 5 size_t i; | 5 while (sz--) |
| 6 | 6 crc = (crc >> 8) ^ crc32_tab[(crc ^ *message++) & 0xFF]; |
| 7 for (i = 0; i < sz; i++) | |
| 8 crc = (crc >> 8) ^ crc32_tab[(crc ^ message[i]) & 0xFF]; | |
| 9 | 7 |
| 10 return crc; | 8 return crc; |
| 11 } | 9 } |
