2 #ifndef FORPY_UTIL_HASH_H_ 3 #define FORPY_UTIL_HASH_H_ 20 static size_t hash_fnv_1a(
const unsigned char *key,
const size_t &len) {
22 size_t h = 14695981039346656037ULL;
24 for (
size_t i = 0; i < len; ++i) {
27 h = (h ^ key[ i ]) * 1099511628211;
37 if (t.empty())
return 0;
38 return hash_fnv_1a(reinterpret_cast<const unsigned char *>(&t[0]),
39 t.size() *
sizeof(size_t) /
sizeof(
unsigned char));
43 #endif // FORPY_UTIL_HASH_H_ static size_t hash_fnv_1a(const unsigned char *key, const size_t &len)
Quick and easy implementation of 64-bit FNV 1a hash.
size_t operator()(const std::vector< size_t > &t) const
A simple vector<size_t> hasher.