16 #ifndef CVMFS_UTIL_MURMUR_H_
17 #define CVMFS_UTIL_MURMUR_H_
21 #define BIG_CONSTANT(x) (x##LLU)
23 inline uint32_t
MurmurHash2 (
const void * key,
int len, uint32_t seed )
28 const uint32_t m = 0x5bd1e995;
33 uint32_t h = seed ^ len;
37 const unsigned char * data = (
const unsigned char *)key;
41 uint32_t k = *(uint32_t*)data;
58 case 3: h ^= data[2] << 16;
59 case 2: h ^= data[1] << 8;
83 inline uint64_t
MurmurHash64A (
const void * key,
int len, uint64_t seed )
88 uint64_t h = seed ^ (len * m);
90 const uint64_t * data = (
const uint64_t *)key;
91 const uint64_t * end = data + (len/8);
105 const unsigned char * data2 = (
const unsigned char*)data;
109 case 7: h ^= uint64_t(data2[6]) << 48;
110 case 6: h ^= uint64_t(data2[5]) << 40;
111 case 5: h ^= uint64_t(data2[4]) << 32;
112 case 4: h ^= uint64_t(data2[3]) << 24;
113 case 3: h ^= uint64_t(data2[2]) << 16;
114 case 2: h ^= uint64_t(data2[1]) << 8;
115 case 1: h ^= uint64_t(data2[0]);
126 #endif // CVMFS_UTIL_MURMUR_H_
uint64_t MurmurHash64A(const void *key, int len, uint64_t seed)
uint32_t MurmurHash2(const void *key, int len, uint32_t seed)