mirror of
https://github.com/boostorg/functional.git
synced 2025-08-02 22:14: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);
|
seed ^= value + 0x9e3779b9 + (seed<<6) + (seed>>2);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename SizeT>
|
|
||||||
inline void hash_combine_impl(boost::uint32_t& h1,
|
inline void hash_combine_impl(boost::uint32_t& h1,
|
||||||
boost::uint32_t k1)
|
boost::uint32_t k1)
|
||||||
{
|
{
|
||||||
@@ -234,7 +233,6 @@ namespace boost
|
|||||||
#if !defined(BOOST_NO_INT64_T) && \
|
#if !defined(BOOST_NO_INT64_T) && \
|
||||||
!(defined(__GNUC__) && ULONG_MAX == 0xffffffff)
|
!(defined(__GNUC__) && ULONG_MAX == 0xffffffff)
|
||||||
|
|
||||||
template <typename SizeT>
|
|
||||||
inline void hash_combine_impl(boost::uint64_t& h,
|
inline void hash_combine_impl(boost::uint64_t& h,
|
||||||
boost::uint64_t k)
|
boost::uint64_t k)
|
||||||
{
|
{
|
||||||
@@ -247,6 +245,10 @@ namespace boost
|
|||||||
|
|
||||||
h ^= k;
|
h ^= k;
|
||||||
h *= m;
|
h *= m;
|
||||||
|
|
||||||
|
// Completely arbitrary number, to prevent 0's
|
||||||
|
// from hashing to 0.
|
||||||
|
h += 0xe6546b64;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // BOOST_NO_INT64_T
|
#endif // BOOST_NO_INT64_T
|
||||||
|
Reference in New Issue
Block a user