1 #include "fnv.h" 2 3 #define FNV_PRIME 0x100000001b3ULL 4 fnv(const void * buf,uint32_t len,uint64_t hval)5uint64_t fnv(const void *buf, uint32_t len, uint64_t hval) 6 { 7 const uint64_t *ptr = buf; 8 const uint64_t *end = (void *) buf + len; 9 10 while (ptr < end) { 11 hval *= FNV_PRIME; 12 hval ^= (uint64_t) *ptr++; 13 } 14 15 return hval; 16 } 17