http://www.isthe.com/chongo/tech/comp/fnv/index.html
*/
-UInt32 hash32(const void *data, unsigned size, unsigned bits)
+uint32_t hash32(const void *data, unsigned size, unsigned bits)
{
if(bits==0 || bits>32)
throw invalid_argument("hash32");
return result;
}
-UInt64 hash64(const void *data, unsigned size, unsigned bits)
+uint64_t hash64(const void *data, unsigned size, unsigned bits)
{
if(bits==0 || bits>64)
throw invalid_argument("hash64");
- static const UInt64 prime = 1099511628211ULL;
- static const UInt64 offset = 14695981039346656037ULL;
+ static const uint64_t prime = 1099511628211ULL;
+ static const uint64_t offset = 14695981039346656037ULL;
- UInt64 result = offset;
+ uint64_t result = offset;
for(unsigned i=0; i<size; ++i)
result = (result^*(reinterpret_cast<const unsigned char *>(data)+i))*prime;