X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fhash.h;h=d696cae5b63542e65d6718f1012d0606b9f55833;hb=47ce9e396aca83fbf90b7130263aaa4c8439af9c;hp=75aba09a57d8e04dfb0a06cdf05f29d90f4c3f4a;hpb=95bd04e16acacde19fcfdcc722baf72b06dcdfee;p=libs%2Fcore.git 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