diff --git a/include/boost/functional/hash/detail/hash_float.hpp b/include/boost/functional/hash/detail/hash_float.hpp index a98cd70..2ac22da 100644 --- a/include/boost/functional/hash/detail/hash_float.hpp +++ b/include/boost/functional/hash/detail/hash_float.hpp @@ -90,15 +90,20 @@ namespace boost return seed; } + template + struct enable_binary_hash + { + BOOST_STATIC_CONSTANT(bool, value = + std::numeric_limits::is_iec559 && + std::numeric_limits::digits == digits && + std::numeric_limits::radix == 2 && + std::numeric_limits::max_exponent == max_exponent); + }; + template inline std::size_t float_hash_impl(Float v, BOOST_DEDUCED_TYPENAME boost::enable_if_c< - std::numeric_limits::is_iec559 && - std::numeric_limits::digits == 24 && - std::numeric_limits::radix == 2 && - std::numeric_limits::max_exponent == 128, - int>::type - ) + enable_binary_hash::value, int>::type) { return hash_binary((char*) &v, 4); } @@ -107,12 +112,7 @@ namespace boost template inline std::size_t float_hash_impl(Float v, BOOST_DEDUCED_TYPENAME boost::enable_if_c< - std::numeric_limits::is_iec559 && - std::numeric_limits::digits == 53 && - std::numeric_limits::radix == 2 && - std::numeric_limits::max_exponent == 1024, - int>::type - ) + enable_binary_hash::value, int>::type) { return hash_binary((char*) &v, 8); } @@ -120,12 +120,7 @@ namespace boost template inline std::size_t float_hash_impl(Float v, BOOST_DEDUCED_TYPENAME boost::enable_if_c< - std::numeric_limits::is_iec559 && - std::numeric_limits::digits == 64 && - std::numeric_limits::radix == 2 && - std::numeric_limits::max_exponent == 16384, - int>::type - ) + enable_binary_hash::value, int>::type) { return hash_binary((char*) &v, 10); } diff --git a/include/boost/functional/hash/hash.hpp b/include/boost/functional/hash/hash.hpp index aa4e49f..0adf9c9 100644 --- a/include/boost/functional/hash/hash.hpp +++ b/include/boost/functional/hash/hash.hpp @@ -27,6 +27,13 @@ #include #endif +#if defined(BOOST_MSVC) +#pragma warning(push) +#pragma warning(disable:6295) // Ill-defined for-loop : 'unsigned int' values + // are always of range '0' to '4294967295'. + // Loop executes infinitely. +#endif + #if BOOST_WORKAROUND(__GNUC__, < 3) \ && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) #define BOOST_HASH_CHAR_TRAITS string_char_traits @@ -518,6 +525,10 @@ namespace boost #undef BOOST_HASH_CHAR_TRAITS +#if defined(BOOST_MSVC) +#pragma warning(pop) +#endif + #endif // BOOST_FUNCTIONAL_HASH_HASH_HPP // Include this outside of the include guards in case the file is included