Mercurial > crc32
diff crc32i.h @ 1:90cb48b87dcc
*: don't hardcode the list of impls in multiple places
| author | Paper <paper@tflc.us> |
|---|---|
| date | Mon, 09 Feb 2026 01:18:06 -0500 |
| parents | 422835bc1aca |
| children | 6483683ac857 |
line wrap: on
line diff
--- a/crc32i.h Mon Feb 09 01:15:00 2026 -0500 +++ b/crc32i.h Mon Feb 09 01:18:06 2026 -0500 @@ -29,12 +29,9 @@ /* shared by crc32c and crc32qw */ extern const uint32_t crc32_tab[256]; -/* Calculates crc32 by bytes. Has no alignment requirement */ -uint32_t crc32c_r(uint32_t crc, const unsigned char *message, size_t sz); -/* Calculates crc32 in dwords. Requires 4-byte alignment */ -uint32_t crc32qw_r(uint32_t crc, const unsigned char *message, size_t sz); -/* Calculates crc32 using intel SIMD. Requires 16-byte alignment */ -uint32_t crc32x86_vpclmulqdq_r(uint32_t crc, const unsigned char *msg, size_t sz); +/* declare */ +#define CRC32_IMPL(name) uint32_t crc32##name##_r(uint32_t, const unsigned char *, size_t); +#include "crc32-impls.h" /* Maximum alignment value for each impl to work */ #define MAX(x, y) ((x)>(y)?(x):(y))
