10 #define _CRC_ALIGN(sz, insn) \
12 if (((uintptr_t)src_u8 & sizeof(sz)) && (u64)len >= sizeof(sz)) { \
13 crc = __crc32##insn(crc, *((const sz *)src_u8)); \
14 src_u8 += sizeof(sz); \
19 #define _CRC_REMAINDER(sz, insn) \
21 if (len & sizeof(sz)) { \
22 crc = __crc32##insn(crc, *((const sz *)src_u8)); \
23 src_u8 += sizeof(sz); \
30 const u8 *src_u8 = (
const u8 *)src;
39 while ((len -=
sizeof(
u64)) >= 0) {
40 crc = __crc32d(crc, *((
const u64 *)src_u8));
41 src_u8 +=
sizeof(
u64);
44 _CRC_REMAINDER(
u32, w);
45 _CRC_REMAINDER(
u16, h);
46 _CRC_REMAINDER(
u8, b);
59 const u8 *src_u8 = (
const u8 *)src;
68 while ((len -=
sizeof(
u64)) >= 0) {
69 crc = __crc32cd(crc, *((
const u64 *)src_u8));
70 src_u8 +=
sizeof(
u64);
73 _CRC_REMAINDER(
u32, cw);
74 _CRC_REMAINDER(
u16, ch);
75 _CRC_REMAINDER(
u8, cb);
static u32 crc32cCalculateWithSeed(u32 seed, const void *src, size_t size)
Calculate a CRC32C over data using a seed.
Definition: crc.h:58
static u32 crc32Calculate(const void *src, size_t size)
Calculate a CRC32 over data.
Definition: crc.h:52
static u32 crc32cCalculate(const void *src, size_t size)
Calculate a CRC32C over data.
Definition: crc.h:81
static u32 crc32CalculateWithSeed(u32 seed, const void *src, size_t size)
Calculate a CRC32 over data using a seed.
Definition: crc.h:29
int64_t s64
64-bit signed integer.
Definition: types.h:28
uint64_t u64
64-bit unsigned integer.
Definition: types.h:22
uint8_t u8
8-bit unsigned integer.
Definition: types.h:19
uint16_t u16
16-bit unsigned integer.
Definition: types.h:20
uint32_t u32
32-bit unsigned integer.
Definition: types.h:21