forked from boostorg/functional
Remove optimization which causes 0.5 to hash to 0. Refs #4038.
I have an internal requirement the 0 hashes to 0, a better solution might be to remove that, put the optimization back and hash 0 to another value. Or alternatively, use the main combine function instead. [SVN r60805]
This commit is contained in:
@@ -51,17 +51,15 @@ namespace boost
|
||||
limits<T>::min_exponent;
|
||||
}
|
||||
|
||||
// The result of frexp is always between 0.5 and 1, so its
|
||||
// top bit will always be 1. Subtract by 0.5 to remove that.
|
||||
v -= T(0.5);
|
||||
v = ldexp(v, limits<std::size_t>::digits + 1);
|
||||
v = ldexp(v, limits<std::size_t>::digits);
|
||||
std::size_t seed = static_cast<std::size_t>(v);
|
||||
v -= seed;
|
||||
|
||||
// ceiling(digits(T) * log2(radix(T))/ digits(size_t)) - 1;
|
||||
std::size_t const length
|
||||
= (limits<T>::digits *
|
||||
boost::static_log2<limits<T>::radix>::value - 1)
|
||||
boost::static_log2<limits<T>::radix>::value
|
||||
+ limits<std::size_t>::digits - 1)
|
||||
/ limits<std::size_t>::digits;
|
||||
|
||||
for(std::size_t i = 0; i != length; ++i)
|
||||
|
||||
Reference in New Issue
Block a user