16 #ifndef IMPALA_UTIL_HASH_UTIL_H
17 #define IMPALA_UTIL_HASH_UTIL_H
37 static uint32_t
CrcHash(
const void* data, int32_t bytes, uint32_t
hash) {
39 uint32_t words = bytes /
sizeof(uint32_t);
40 bytes = bytes %
sizeof(uint32_t);
42 const uint32_t* p =
reinterpret_cast<const uint32_t*
>(data);
48 const uint8_t* s =
reinterpret_cast<const uint8_t*
>(p);
56 hash = (hash << 16) | (hash >> 16);
79 const uint8_t* data2 =
reinterpret_cast<const uint8_t*
>(data);
81 case 7: h ^=
uint64_t(data2[6]) << 48;
82 case 6: h ^=
uint64_t(data2[5]) << 40;
83 case 5: h ^=
uint64_t(data2[4]) << 32;
84 case 4: h ^=
uint64_t(data2[3]) << 24;
85 case 3: h ^=
uint64_t(data2[2]) << 16;
86 case 2: h ^=
uint64_t(data2[1]) << 8;
113 const uint8_t* ptr =
reinterpret_cast<const uint8_t*
>(data);
127 hash_u64 =
FnvHash64(data, bytes, hash_u64);
128 return (hash_u64 >> 32) ^ (hash_u64 & 0xFFFFFFFF);
135 static uint32_t
Hash(
const void* data, int32_t bytes, uint32_t seed) {
137 return CrcHash(data, bytes, seed);
const StringSearch UrlParser::hash_search & hash
static uint32_t SSE4_crc32_u8(uint32_t crc, uint8_t v)
static uint32_t Hash(const void *data, int32_t bytes, uint32_t seed)
Utility class to compute hash values.
static uint32_t SSE4_crc32_u32(uint32_t crc, uint32_t v)
static const uint64_t FNV64_SEED
static const int64_t SSE4_2
static uint64_t FnvHash64(const void *data, int32_t bytes, uint64_t hash)
static const uint32_t FNV_PRIME
default values recommended by http://isthe.com/chongo/tech/comp/fnv/
static const uint64_t FNV64_PRIME
static const uint32_t FNV_SEED
static const int MURMUR_R
static uint32_t CrcHash(const void *data, int32_t bytes, uint32_t hash)
static uint32_t FnvHash64to32(const void *data, int32_t bytes, uint32_t hash)
static const uint64_t MURMUR_PRIME
static bool IsSupported(long flag)
Returns whether of not the cpu supports this flag.
static uint64_t MurmurHash2_64(const void *input, int len, uint64_t seed)
Murmur2 hash implementation returning 64-bit hashes.