1 #ifndef MSP_CORE_HASH_H_
2 #define MSP_CORE_HASH_H_
9 typedef __uint64 HashValue64;
11 typedef unsigned long long HashValue64;
15 Computes a 32-bit Fowler-Noll-Vo (FNV-1a) hash. The number of bits can be
16 limited to less than 32, in which case XOR-folding is used to reduce the hash
19 unsigned hash32(const void *, unsigned, unsigned = 32);
22 Convenience function to compute a 32-bit hash of a string.
24 inline unsigned hash32(const std::string &s, unsigned b = 32)
25 { return hash32(s.data(), s.size(), b); }
28 Computes a 64-bit Fowler-Noll-Vo (FNV-1a) hash. Note that even if bits is
29 limited to 32 or less, this does not produce the same result as hash32.
31 HashValue64 hash64(const void *, unsigned, unsigned = 64);
34 Convenience function to compute a 64-bit hash of a string.
36 inline HashValue64 hash64(const std::string &s, unsigned b = 64)
37 { return hash64(s.data(), s.size(), b); }