16 #ifndef __included_crc32_h__ 17 #define __included_crc32_h__ 22 #define clib_crc32c_uses_intrinsics 23 #include <x86intrin.h> 25 #define crc32_u64 _mm_crc32_u64 28 clib_crc32c (
u8 * s,
int len)
33 for (; len >= 8; len -= 8, s += 8)
34 v = _mm_crc32_u64 (v, *((
u64 *) s));
38 volatile (
"":::
"memory");
41 for (; len >= 4; len -= 4, s += 4)
42 v = _mm_crc32_u32 (v, *((
u32 *) s));
44 for (; len >= 2; len -= 2, s += 2)
45 v = _mm_crc32_u16 (v, *((
u16 *) s));
47 for (; len >= 1; len -= 1, s += 1)
48 v = _mm_crc32_u8 (v, *((
u16 *) s));
53 #elif __ARM_FEATURE_CRC32 54 #define clib_crc32c_uses_intrinsics 58 #define crc32_u64 __crc32cd 61 clib_crc32c (
u8 * s,
int len)
65 for (; len >= 8; len -= 8, s += 8)
66 v = __crc32cd (v, *((
u64 *) s));
68 for (; len >= 4; len -= 4, s += 4)
69 v = __crc32cw (v, *((
u32 *) s));
71 for (; len >= 2; len -= 2, s += 2)
72 v = __crc32ch (v, *((
u16 *) s));
74 for (; len >= 1; len -= 1, s += 1)
75 v = __crc32cb (v, *((
u8 *) s));
#define static_always_inline