boost/functional/detail/hash_float.hpp: patch to quiet gcc warning

The for loop in float_hash_impl in <boost/functional/detail/hash_float.hpp> generates a warning from gcc when instantiated with T = float. Changing the < to != quiets the warning. Here's the warning: /pkg/boost/include/boost/functional/detail/hash_float.hpp: In function 'size_t boost::hash_detail::float_hash_ impl(T) [with T = float]': /pkg/boost/include/boost/functional/detail/hash_float.hpp:136: instantiated from 'size_t boost::hash_detail: :float_hash_value(T) [with T = float]' /pkg/boost/include/boost/functional/hash/hash.hpp:307: instantiated from here /pkg/boost/include/boost/functional/detail/hash_float.hpp:109: warning: comparison of unsigned expression < 0 is always false Here's the patch: diff -ur boost-1.35.0-svn38670/include/boost/functional/detail/hash_fl oat.hpp boost/include/boost/functional/detail/hash_float.hpp --- boost-1.35.0-svn38670/include/boost/functional/detail/hash_float.hpp 2007-08-15 07:52:45.838953000 -0400 +++ boost/include/boost/functional/detail/hash_float.hpp 2007-08-14 12:59:02.358904000 -0400 @@ -106,7 +106,7 @@ boost::static_log2<limits<T>::radix>::value - 1) / limits<std::size_t>::digits; - for(std::size_t i = 0; i < length; ++i) + for(std::size_t i = 0; i != length; ++i) { v = boost::hash_detail::call_ldexp(v, limits<std::size_t>::digits); std::size_t part = static_cast<std::size_t>(v); -- Caleb Epstein

Caleb Epstein wrote:
The for loop in float_hash_impl in <boost/functional/detail/hash_float.hpp> generates a warning from gcc when instantiated with T = float. Changing the < to != quiets the warning.
This should be fixed in trunk now. Daniel
participants (2)
-
Caleb Epstein
-
Daniel James