summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2014-10-19 20:22:58 (GMT)
committerTobias Markmann <tm@ayena.de>2014-10-20 13:49:33 (GMT)
commit6b22dfcf59474dd016a0355a3102a1dd3692d92c (patch)
tree2b1fd33be433a91e81fee84fdc2bf1b52575d934 /3rdParty/Boost/src/boost/functional/hash/detail/hash_float.hpp
parent38b0cb785fea8eae5e48fae56440695fdfd10ee1 (diff)
downloadswift-6b22dfcf59474dd016a0355a3102a1dd3692d92c.zip
swift-6b22dfcf59474dd016a0355a3102a1dd3692d92c.tar.bz2
Update Boost in 3rdParty to version 1.56.0.
This updates Boost in our 3rdParty directory to version 1.56.0. Updated our update.sh script to stop on error. Changed error reporting in SwiftTools/CrashReporter.cpp to SWIFT_LOG due to missing include of <iostream> with newer Boost. Change-Id: I4b35c77de951333979a524097f35f5f83d325edc
Diffstat (limited to '3rdParty/Boost/src/boost/functional/hash/detail/hash_float.hpp')
-rw-r--r--3rdParty/Boost/src/boost/functional/hash/detail/hash_float.hpp61
1 files changed, 32 insertions, 29 deletions
diff --git a/3rdParty/Boost/src/boost/functional/hash/detail/hash_float.hpp b/3rdParty/Boost/src/boost/functional/hash/detail/hash_float.hpp
index 3edc6ab..ee0ee87 100644
--- a/3rdParty/Boost/src/boost/functional/hash/detail/hash_float.hpp
+++ b/3rdParty/Boost/src/boost/functional/hash/detail/hash_float.hpp
@@ -6,11 +6,11 @@
#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_HEADER)
#define BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_HEADER
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
+#include <boost/config.hpp>
+#if defined(BOOST_HAS_PRAGMA_ONCE)
+#pragma once
#endif
-#include <boost/config.hpp>
#include <boost/functional/hash/detail/float_functions.hpp>
#include <boost/functional/hash/detail/limits.hpp>
#include <boost/utility/enable_if.hpp>
@@ -73,7 +73,9 @@ namespace boost
ptr += sizeof(std::size_t);
while(length >= sizeof(std::size_t)) {
- hash_float_combine(seed, *(std::size_t*) ptr);
+ std::size_t buffer = 0;
+ std::memcpy(&buffer, ptr, sizeof(std::size_t));
+ hash_float_combine(seed, buffer);
length -= sizeof(std::size_t);
ptr += sizeof(std::size_t);
}
@@ -88,15 +90,21 @@ 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,
+ std::size_t>::type)
{
return hash_binary((char*) &v, 4);
}
@@ -105,12 +113,8 @@ 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,
+ std::size_t>::type)
{
return hash_binary((char*) &v, 8);
}
@@ -118,12 +122,8 @@ 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,
+ std::size_t>::type)
{
return hash_binary((char*) &v, 10);
}
@@ -131,12 +131,8 @@ 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 == 113 &&
- std::numeric_limits<Float>::radix == 2 &&
- std::numeric_limits<Float>::max_exponent == 16384,
- int>::type
- )
+ enable_binary_hash<Float, 113, 16384>::value,
+ std::size_t>::type)
{
return hash_binary((char*) &v, 16);
}
@@ -210,8 +206,15 @@ namespace boost
template <class T>
inline std::size_t float_hash_value(T v)
{
+#if defined(fpclassify)
+ switch (fpclassify(v))
+#elif BOOST_HASH_CONFORMANT_FLOATS
+ switch (std::fpclassify(v))
+#else
using namespace std;
- switch (fpclassify(v)) {
+ switch (fpclassify(v))
+#endif
+ {
case FP_ZERO:
return 0;
case FP_INFINITE: