9#define DC_FNV1A_64_OFFSET 14695981039346656037ull
10#define DC_FNV1A_64_PRIME 1099511628211ull
14 const unsigned char* p = (
const unsigned char*)(s);
17 for (
unsigned char c = *p; c != 0; c = *++p) {
34 for (
int i = 0; i < 8; ++i) {
35 h ^= (uint64_t)(x & 0xffU);
46 for (
int i = 0; i < 4; ++i) {
47 h ^= (uint64_t)(x & 0xffU);
55#define FNV1A_INTEGER(type, ...) \
56 DC_PUBLIC static size_t type##_hash_fnv1a(type const* key) { \
57 DC_STATIC_ASSERT(sizeof(type) <= sizeof(uint64_t), \
58 "fnv integer hashing only supports up to size_t integers"); \
59 if (sizeof(type) <= sizeof(uint32_t)) { \
60 uint32_t value = (uint32_t)(*key); \
61 return dc_fnv1a_u32(&value); \
63 uint64_t value = (uint64_t)(*key); \
64 return dc_fnv1a_u64(&value); \
#define DC_FNV1A_64_OFFSET
FNV-1a 64-bit constants.
static DC_PUBLIC uint64_t dc_fnv1a_u32(uint32_t const *v)
#define DC_FNV1A_64_PRIME
static DC_PUBLIC uint64_t dc_fnv1a_str(char *const *s)
static DC_PUBLIC uint64_t dc_fnv1a_str_borrow(const char *s)
Hashes a null terminated string.
#define FNV1A_INTEGER(type,...)
Applying the fnv1a hash for the size of the integer.
static DC_PUBLIC uint64_t dc_fnv1a_str_const(const char *const *s)
static DC_PUBLIC uint64_t dc_fnv1a_u64(uint64_t const *v)
#define DC_INT_REFLECT(F,...)