Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r85389 - in branches/release: boost/functional boost/functional/hash boost/functional/hash/detail libs/functional
From: dnljms_at_[hidden]
Date: 2013-08-18 05:48:53


Author: danieljames
Date: 2013-08-18 05:48:53 EDT (Sun, 18 Aug 2013)
New Revision: 85389
URL: http://svn.boost.org/trac/boost/changeset/85389

Log:
Merge Hash. Fixes #8568, Refs #8822.#8822.#8822.

Properties modified:
   branches/release/boost/functional/ (props changed)
   branches/release/boost/functional/hash/ (props changed)
   branches/release/libs/functional/ (props changed)
Text files modified:
   branches/release/boost/functional/hash/detail/hash_float.hpp | 31 +++++++++++++------------------
   branches/release/boost/functional/hash/hash.hpp | 11 +++++++++++
   2 files changed, 24 insertions(+), 18 deletions(-)

Modified: branches/release/boost/functional/hash/detail/hash_float.hpp
==============================================================================
--- branches/release/boost/functional/hash/detail/hash_float.hpp Sun Aug 18 05:44:14 2013 (r85388)
+++ branches/release/boost/functional/hash/detail/hash_float.hpp 2013-08-18 05:48:53 EDT (Sun, 18 Aug 2013) (r85389)
@@ -90,15 +90,20 @@
             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 @@
         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 @@
         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);
         }

Modified: branches/release/boost/functional/hash/hash.hpp
==============================================================================
--- branches/release/boost/functional/hash/hash.hpp Sun Aug 18 05:44:14 2013 (r85388)
+++ branches/release/boost/functional/hash/hash.hpp 2013-08-18 05:48:53 EDT (Sun, 18 Aug 2013) (r85389)
@@ -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 @@
 
 #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


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk