Lines Matching refs:hash

25 // This file defines Hash_bytes, a primitive used for defining hash
30 // exactly the same interface but using a different hash algorithm,
31 // Fowler / Noll / Vo (FNV) Hash (type FNV-1a). The Murmur hash
32 // function apears to be better in both speed and hash quality, and
72 // Implementation of Murmur hash for 32-bit size_t.
77 size_t hash = seed ^ len;
80 // Mix 4 bytes at a time into the hash.
87 hash *= m;
88 hash ^= k;
97 hash ^= static_cast<unsigned char>(buf[2]) << 16;
100 hash ^= static_cast<unsigned char>(buf[1]) << 8;
103 hash ^= static_cast<unsigned char>(buf[0]);
104 hash *= m;
107 // Do a few final mixes of the hash.
108 hash ^= hash >> 13;
109 hash *= m;
110 hash ^= hash >> 15;
111 return hash;
114 // Implementation of FNV hash for 32-bit size_t.
119 _Fnv_hash_bytes(const void* ptr, size_t len, size_t hash)
124 hash ^= static_cast<size_t>(*cptr++);
125 hash *= static_cast<size_t>(16777619UL);
127 return hash;
132 // Implementation of Murmur hash for 64-bit size_t.
144 size_t hash = seed ^ (len * mul);
148 hash ^= data;
149 hash *= mul;
154 hash ^= data;
155 hash *= mul;
157 hash = shift_mix(hash) * mul;
158 hash = shift_mix(hash);
159 return hash;
162 // Implementation of FNV hash for 64-bit size_t.
167 _Fnv_hash_bytes(const void* ptr, size_t len, size_t hash)
172 hash ^= static_cast<size_t>(*cptr++);
173 hash *= static_cast<size_t>(1099511628211ULL);
175 return hash;
180 // Dummy hash implementation for unusual sizeof(size_t).
184 size_t hash = seed;
187 hash = (hash * 131) + *cptr++;
188 return hash;