#ifndef UTIL_HASH_H #define UTIL_HASH_H #include #include #include uint64_t murmur_hash_64a(void const * key, int len, unsigned int seed); static inline uint64_t murmur_hash_str_64s(char const * str, unsigned int seed) { return murmur_hash_64a(str, strlen(str), seed); } static inline uint64_t murmur64(uint64_t h) { h ^= h >> 33; h *= 0xff51afd7ed558ccdLLU; h ^= h >> 33; h *= 0xc4ceb9fe1a85ec53LLU; h ^= h >> 33; return h; } static inline size_t murmur64_range(uint64_t h, size_t n) { return murmur64(h) % n; } #endif /* ifndef UTIL_HASH_H */