mirror of
https://github.com/boostorg/functional.git
synced 2025-07-30 20:47:17 +02:00
@ -90,15 +90,20 @@ namespace boost
|
||||
return seed;
|
||||
}
|
||||
|
||||
template <typename Float, unsigned digits, unsigned max_exponent>
|
||||
struct enable_binary_hash
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value =
|
||||
std::numeric_limits<Float>::is_iec559 &&
|
||||
std::numeric_limits<Float>::digits == digits &&
|
||||
std::numeric_limits<Float>::radix == 2 &&
|
||||
std::numeric_limits<Float>::max_exponent == max_exponent);
|
||||
};
|
||||
|
||||
template <typename Float>
|
||||
inline std::size_t float_hash_impl(Float v,
|
||||
BOOST_DEDUCED_TYPENAME boost::enable_if_c<
|
||||
std::numeric_limits<Float>::is_iec559 &&
|
||||
std::numeric_limits<Float>::digits == 24 &&
|
||||
std::numeric_limits<Float>::radix == 2 &&
|
||||
std::numeric_limits<Float>::max_exponent == 128,
|
||||
int>::type
|
||||
)
|
||||
enable_binary_hash<Float, 24, 128>::value, int>::type)
|
||||
{
|
||||
return hash_binary((char*) &v, 4);
|
||||
}
|
||||
@ -107,12 +112,7 @@ namespace boost
|
||||
template <typename Float>
|
||||
inline std::size_t float_hash_impl(Float v,
|
||||
BOOST_DEDUCED_TYPENAME boost::enable_if_c<
|
||||
std::numeric_limits<Float>::is_iec559 &&
|
||||
std::numeric_limits<Float>::digits == 53 &&
|
||||
std::numeric_limits<Float>::radix == 2 &&
|
||||
std::numeric_limits<Float>::max_exponent == 1024,
|
||||
int>::type
|
||||
)
|
||||
enable_binary_hash<Float, 53, 1024>::value, int>::type)
|
||||
{
|
||||
return hash_binary((char*) &v, 8);
|
||||
}
|
||||
@ -120,12 +120,7 @@ namespace boost
|
||||
template <typename Float>
|
||||
inline std::size_t float_hash_impl(Float v,
|
||||
BOOST_DEDUCED_TYPENAME boost::enable_if_c<
|
||||
std::numeric_limits<Float>::is_iec559 &&
|
||||
std::numeric_limits<Float>::digits == 64 &&
|
||||
std::numeric_limits<Float>::radix == 2 &&
|
||||
std::numeric_limits<Float>::max_exponent == 16384,
|
||||
int>::type
|
||||
)
|
||||
enable_binary_hash<Float, 64, 16384>::value, int>::type)
|
||||
{
|
||||
return hash_binary((char*) &v, 10);
|
||||
}
|
||||
|
@ -27,6 +27,13 @@
|
||||
#include <typeindex>
|
||||
#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
|
||||
|
Reference in New Issue
Block a user