X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fcore%2Fhash.h;h=d696cae5b63542e65d6718f1012d0606b9f55833;hp=75aba09a57d8e04dfb0a06cdf05f29d90f4c3f4a;hb=229f0438383b1ab7d0de0f9ea9a9a2912363bdbc;hpb=fa87d901ba9fa075e51637608902b7fbdd71f896 diff --git a/source/core/hash.h b/source/core/hash.h index 75aba09..d696cae 100644 --- a/source/core/hash.h +++ b/source/core/hash.h @@ -31,6 +31,12 @@ Convenience function to compute a 64-bit hash of a string. inline UInt64 hash64(const std::string &s, unsigned b = 64) { return hash64(s.data(), s.size(), b); } +inline UInt32 fold32(UInt64 hash) +{ return hash^(hash>>32); } + +inline UInt16 fold16(UInt64 hash) +{ return hash^(hash>>16)^(hash>>32)^(hash>>48); } + } // namespace Msp #endif