39 #include <sys/cdefs.h>
40 #include <sys/types.h>
43 extern const uint32_t crc32_tab[];
45 #define rounddown(x, y) (((x) / (y)) * (y))
46 #define rounddown2(x, y) ((x) & (~((y)-1)))
47 #define roundup2(x, y) (((x) + ((y)-1)) & (~((y)-1)))
49 static __inline uint32_t
50 crc32_raw(
const void *buf,
size_t size, uint32_t crc)
52 const uint8_t *p = (
const uint8_t *)buf;
55 crc = crc32_tab[(crc ^ *p++) & 0xFF] ^ (crc >> 8);
59 static __inline uint32_t
60 crc32(
const void *buf,
size_t size)
64 crc = crc32_raw(buf, size, ~0U);
68 uint32_t calculate_crc32c(uint32_t crc32c,
const unsigned char *buffer,
unsigned int length);
70 uint32_t sse42_crc32c(uint32_t,
const unsigned char *,
unsigned);