mirror of
https://github.com/boostorg/functional.git
synced 2025-08-01 21:44:28 +02:00
Fix the binary 32 and 64 bit hash functions.
This commit is contained in:
@@ -212,7 +212,6 @@ namespace boost
|
||||
seed ^= value + 0x9e3779b9 + (seed<<6) + (seed>>2);
|
||||
}
|
||||
|
||||
template <typename SizeT>
|
||||
inline void hash_combine_impl(boost::uint32_t& h1,
|
||||
boost::uint32_t k1)
|
||||
{
|
||||
@@ -234,7 +233,6 @@ namespace boost
|
||||
#if !defined(BOOST_NO_INT64_T) && \
|
||||
!(defined(__GNUC__) && ULONG_MAX == 0xffffffff)
|
||||
|
||||
template <typename SizeT>
|
||||
inline void hash_combine_impl(boost::uint64_t& h,
|
||||
boost::uint64_t k)
|
||||
{
|
||||
@@ -247,6 +245,10 @@ namespace boost
|
||||
|
||||
h ^= k;
|
||||
h *= m;
|
||||
|
||||
// Completely arbitrary number, to prevent 0's
|
||||
// from hashing to 0.
|
||||
h += 0xe6546b64;
|
||||
}
|
||||
|
||||
#endif // BOOST_NO_INT64_T
|
||||
|
Reference in New Issue
Block a user