3 #define FNV_PRIME 0x100000001b3ULL
6 * 64-bit fnv, but don't require 64-bit multiples of data. Use bytes
7 * for the last unaligned chunk.
9 uint64_t fnv(const void *buf, uint32_t len, uint64_t hval)
11 const uint64_t *ptr = buf;
15 if (len >= sizeof(uint64_t)) {
16 hval ^= (uint64_t) *ptr++;
17 len -= sizeof(uint64_t);
20 const uint8_t *ptr8 = (const uint8_t *) ptr;
24 for (i = 0; i < len; i++) {
26 val |= (uint8_t) *ptr8++;