summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '3rdParty/Boost/src/boost/functional/hash')
-rw-r--r--3rdParty/Boost/src/boost/functional/hash/detail/float_functions.hpp332
-rw-r--r--3rdParty/Boost/src/boost/functional/hash/detail/hash_float.hpp170
-rw-r--r--3rdParty/Boost/src/boost/functional/hash/detail/hash_float_generic.hpp93
-rw-r--r--3rdParty/Boost/src/boost/functional/hash/detail/hash_float_x86.hpp56
-rw-r--r--3rdParty/Boost/src/boost/functional/hash/detail/limits.hpp61
-rw-r--r--3rdParty/Boost/src/boost/functional/hash/extensions.hpp110
-rw-r--r--3rdParty/Boost/src/boost/functional/hash/hash.hpp144
7 files changed, 617 insertions, 349 deletions
diff --git a/3rdParty/Boost/src/boost/functional/hash/detail/float_functions.hpp b/3rdParty/Boost/src/boost/functional/hash/detail/float_functions.hpp
index 69cf91a..ae03ff0 100644
--- a/3rdParty/Boost/src/boost/functional/hash/detail/float_functions.hpp
+++ b/3rdParty/Boost/src/boost/functional/hash/detail/float_functions.hpp
@@ -6,6 +6,7 @@
#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_FLOAT_FUNCTIONS_HPP)
#define BOOST_FUNCTIONAL_HASH_DETAIL_FLOAT_FUNCTIONS_HPP
+#include <boost/config.hpp>
#include <boost/config/no_tr1/cmath.hpp>
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
@@ -17,146 +18,229 @@
// library implementations don't support this. On some that don't, the C99
// float functions (frexpf, frexpl, etc.) are available.
//
-// Some of this is based on guess work. If I don't know any better I assume that
-// the standard C++ overloaded functions are available. If they're not then this
-// means that the argument is cast to a double and back, which is inefficient
-// and will give pretty bad results for long doubles - so if you know better
-// let me know.
-
-// STLport:
-#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
-# if (defined(__GNUC__) && __GNUC__ < 3 && (defined(linux) || defined(__linux) || defined(__linux__))) || defined(__DMC__)
-# define BOOST_HASH_USE_C99_FLOAT_FUNCS
-# elif defined(BOOST_MSVC) && BOOST_MSVC < 1300
-# define BOOST_HASH_USE_C99_FLOAT_FUNCS
-# else
-# define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS
-# endif
-
-// Roguewave:
+// The following tries to automatically detect which are available.
+
+namespace boost {
+ namespace hash_detail {
+
+ // Returned by dummy versions of the float functions.
+
+ struct not_found {
+ // Implicitly convertible to float and long double in order to avoid
+ // a compile error when the dummy float functions are used.
+
+ inline operator float() const { return 0; }
+ inline operator long double() const { return 0; }
+ };
+
+ // A type for detecting the return type of functions.
+
+ template <typename T> struct is;
+ template <> struct is<float> { char x[10]; };
+ template <> struct is<double> { char x[20]; };
+ template <> struct is<long double> { char x[30]; };
+ template <> struct is<boost::hash_detail::not_found> { char x[40]; };
+
+ // Used to convert the return type of a function to a type for sizeof.
+
+ template <typename T> is<T> float_type(T);
+
+ // call_ldexp
+ //
+ // This will get specialized for float and long double
+
+ template <typename Float> struct call_ldexp
+ {
+ typedef double float_type;
+
+ inline double operator()(double a, int b) const
+ {
+ using namespace std;
+ return ldexp(a, b);
+ }
+ };
+
+ // call_frexp
+ //
+ // This will get specialized for float and long double
+
+ template <typename Float> struct call_frexp
+ {
+ typedef double float_type;
+
+ inline double operator()(double a, int* b) const
+ {
+ using namespace std;
+ return frexp(a, b);
+ }
+ };
+ }
+}
+
+// A namespace for dummy functions to detect when the actual function we want
+// isn't available. ldexpl, ldexpf etc. might be added tby the macros below.
//
-// On borland 5.51, with roguewave 2.1.1 the standard C++ overloads aren't
-// defined, but for the same version of roguewave on sunpro they are.
-#elif defined(_RWSTD_VER)
-# if defined(__BORLANDC__)
-# define BOOST_HASH_USE_C99_FLOAT_FUNCS
-# define BOOST_HASH_C99_NO_FLOAT_FUNCS
-# elif defined(__DECCXX)
-# define BOOST_HASH_USE_C99_FLOAT_FUNCS
-# else
-# define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS
-# endif
-
-// libstdc++ (gcc 3.0 onwards, I think)
-#elif defined(__GLIBCPP__) || defined(__GLIBCXX__)
-# define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS
-
-// SGI:
-#elif defined(__STL_CONFIG_H)
-# if defined(linux) || defined(__linux) || defined(__linux__)
-# define BOOST_HASH_USE_C99_FLOAT_FUNCS
-# else
-# define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS
-# endif
-
-// vxWorks. It has its own math library, but uses Dinkumware STL
-#elif defined(__VXWORKS__)
-# define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS
-
-// Dinkumware.
-#elif (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER)
-// Some versions of Visual C++ don't seem to have the C++ overloads but they
-// all seem to have the c99 float overloads
-# if defined(BOOST_MSVC)
-# define BOOST_HASH_USE_C99_FLOAT_FUNCS
-// On other platforms the C++ overloads seem to have been introduced sometime
-// before 402.
-# elif defined(_CPPLIB_VER) && (_CPPLIB_VER >= 402)
-# define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS
-# else
-# define BOOST_HASH_USE_C99_FLOAT_FUNCS
-# endif
-
-// Digital Mars
-#elif defined(__DMC__)
-# define BOOST_HASH_USE_C99_FLOAT_FUNCS
-
-// Use overloaded float functions by default.
-#else
-# define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS
-#endif
+// AFAICT these have to be outside of the boost namespace, as if they're in
+// the boost namespace they'll always be preferable to any other function
+// (since the arguments are built in types, ADL can't be used).
-namespace boost
-{
- namespace hash_detail
- {
+namespace boost_hash_detect_float_functions {
+ template <class Float> boost::hash_detail::not_found ldexp(Float, int);
+ template <class Float> boost::hash_detail::not_found frexp(Float, int*);
+}
- inline float call_ldexp(float v, int exp)
- {
- using namespace std;
-#if defined(BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS) || \
- defined(BOOST_HASH_C99_NO_FLOAT_FUNCS)
- return ldexp(v, exp);
-#else
- return ldexpf(v, exp);
-#endif
- }
+// Macros for generating specializations of call_ldexp and call_frexp.
+//
+// check_cpp and check_c99 check if the C++ or C99 functions are available.
+//
+// Then the call_* functions select an appropriate implementation.
+//
+// I used c99_func in a few places just to get a unique name.
+//
+// Important: when using 'using namespace' at namespace level, include as
+// little as possible in that namespace, as Visual C++ has an odd bug which
+// can cause the namespace to be imported at the global level. This seems to
+// happen mainly when there's a template in the same namesapce.
+
+#define BOOST_HASH_CALL_FLOAT_FUNC(cpp_func, c99_func, type1, type2) \
+namespace boost_hash_detect_float_functions { \
+ template <class Float> \
+ boost::hash_detail::not_found c99_func(Float, type2); \
+} \
+ \
+namespace boost { \
+ namespace hash_detail { \
+ namespace c99_func##_detect { \
+ using namespace std; \
+ using namespace boost_hash_detect_float_functions; \
+ \
+ struct check { \
+ static type1 x; \
+ static type2 y; \
+ BOOST_STATIC_CONSTANT(bool, cpp = \
+ sizeof(float_type(cpp_func(x,y))) \
+ == sizeof(is<type1>)); \
+ BOOST_STATIC_CONSTANT(bool, c99 = \
+ sizeof(float_type(c99_func(x,y))) \
+ == sizeof(is<type1>)); \
+ }; \
+ } \
+ \
+ template <bool x> \
+ struct call_c99_##c99_func : \
+ boost::hash_detail::call_##cpp_func<double> {}; \
+ \
+ template <> \
+ struct call_c99_##c99_func<true> { \
+ typedef type1 float_type; \
+ \
+ template <typename T> \
+ inline type1 operator()(type1 a, T b) const \
+ { \
+ using namespace std; \
+ return c99_func(a, b); \
+ } \
+ }; \
+ \
+ template <bool x> \
+ struct call_cpp_##c99_func : \
+ call_c99_##c99_func< \
+ ::boost::hash_detail::c99_func##_detect::check::c99 \
+ > {}; \
+ \
+ template <> \
+ struct call_cpp_##c99_func<true> { \
+ typedef type1 float_type; \
+ \
+ template <typename T> \
+ inline type1 operator()(type1 a, T b) const \
+ { \
+ using namespace std; \
+ return cpp_func(a, b); \
+ } \
+ }; \
+ \
+ template <> \
+ struct call_##cpp_func<type1> : \
+ call_cpp_##c99_func< \
+ ::boost::hash_detail::c99_func##_detect::check::cpp \
+ > {}; \
+ } \
+}
- inline double call_ldexp(double v, int exp)
- {
- using namespace std;
- return ldexp(v, exp);
- }
+#define BOOST_HASH_CALL_FLOAT_MACRO(cpp_func, c99_func, type1, type2) \
+namespace boost { \
+ namespace hash_detail { \
+ \
+ template <> \
+ struct call_##cpp_func<type1> { \
+ typedef type1 float_type; \
+ inline type1 operator()(type1 x, type2 y) const { \
+ return c99_func(x, y); \
+ } \
+ }; \
+ } \
+}
- inline long double call_ldexp(long double v, int exp)
- {
- using namespace std;
-#if defined(BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS)
- return ldexp(v, exp);
+#if defined(ldexpf)
+BOOST_HASH_CALL_FLOAT_MACRO(ldexp, ldexpf, float, int)
#else
- return ldexpl(v, exp);
+BOOST_HASH_CALL_FLOAT_FUNC(ldexp, ldexpf, float, int)
#endif
- }
- inline float call_frexp(float v, int* exp)
- {
- using namespace std;
-#if defined(BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS) || \
- defined(BOOST_HASH_C99_NO_FLOAT_FUNCS)
- return frexp(v, exp);
+#if defined(ldexpl)
+BOOST_HASH_CALL_FLOAT_MACRO(ldexp, ldexpl, long double, int)
#else
- return frexpf(v, exp);
+BOOST_HASH_CALL_FLOAT_FUNC(ldexp, ldexpl, long double, int)
#endif
- }
-
- inline double call_frexp(double v, int* exp)
- {
- using namespace std;
- return frexp(v, exp);
- }
- inline long double call_frexp(long double v, int* exp)
- {
- using namespace std;
-#if defined(BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS)
- return frexp(v, exp);
+#if defined(frexpf)
+BOOST_HASH_CALL_FLOAT_MACRO(frexp, frexpf, float, int*)
#else
- return frexpl(v, exp);
+BOOST_HASH_CALL_FLOAT_FUNC(frexp, frexpf, float, int*)
#endif
- }
- }
-}
-#if defined(BOOST_HASH_USE_C99_FLOAT_FUNCS)
-#undef BOOST_HASH_USE_C99_FLOAT_FUNCS
+#if defined(frexpl)
+BOOST_HASH_CALL_FLOAT_MACRO(frexp, frexpl, long double, int*)
+#else
+BOOST_HASH_CALL_FLOAT_FUNC(frexp, frexpl, long double, int*)
#endif
-#if defined(BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS)
-#undef BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS
-#endif
+#undef BOOST_HASH_CALL_FLOAT_MACRO
+#undef BOOST_HASH_CALL_FLOAT_FUNC
-#if defined(BOOST_HASH_C99_NO_FLOAT_FUNCS)
-#undef BOOST_HASH_C99_NO_FLOAT_FUNCS
-#endif
+
+namespace boost
+{
+ namespace hash_detail
+ {
+ template <typename Float1, typename Float2>
+ struct select_hash_type_impl {
+ typedef double type;
+ };
+
+ template <>
+ struct select_hash_type_impl<float, float> {
+ typedef float type;
+ };
+
+ template <>
+ struct select_hash_type_impl<long double, long double> {
+ typedef long double type;
+ };
+
+
+ // select_hash_type
+ //
+ // If there is support for a particular floating point type, use that
+ // otherwise use double (there's always support for double).
+
+ template <typename Float>
+ struct select_hash_type : select_hash_type_impl<
+ BOOST_DEDUCED_TYPENAME call_ldexp<Float>::float_type,
+ BOOST_DEDUCED_TYPENAME call_frexp<Float>::float_type
+ > {};
+ }
+}
#endif
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 5d5ac34..ea1bc25 100644
--- a/3rdParty/Boost/src/boost/functional/hash/detail/hash_float.hpp
+++ b/3rdParty/Boost/src/boost/functional/hash/detail/hash_float.hpp
@@ -10,164 +10,57 @@
# pragma once
#endif
-#if defined(BOOST_MSVC)
-#pragma warning(push)
-#if BOOST_MSVC >= 1400
-#pragma warning(disable:6294) // Ill-defined for-loop: initial condition does
- // not satisfy test. Loop body not executed
-#endif
-#endif
-
+#include <boost/config.hpp>
#include <boost/functional/hash/detail/float_functions.hpp>
+#include <boost/functional/hash/detail/limits.hpp>
#include <boost/integer/static_log2.hpp>
#include <boost/cstdint.hpp>
-#include <boost/limits.hpp>
#include <boost/assert.hpp>
-// Select implementation for the current platform.
+// Include hash implementation for the current platform.
// Cygwn
#if defined(__CYGWIN__)
# if defined(__i386__) || defined(_M_IX86)
-# define BOOST_HASH_USE_x86_BINARY_HASH
+# include <boost/functional/hash/detail/hash_float_x86.hpp>
+# else
+# include <boost/functional/hash/detail/hash_float_generic.hpp>
# endif
+#else
+# include <boost/functional/hash/detail/hash_float_generic.hpp>
+#endif
+
+// Can we use fpclassify?
// STLport
-#elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
-// fpclassify aren't good enough on STLport.
+#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
+#define BOOST_HASH_USE_FPCLASSIFY 0
// GNU libstdc++ 3
#elif defined(__GLIBCPP__) || defined(__GLIBCXX__)
# if (defined(__USE_ISOC99) || defined(_GLIBCXX_USE_C99_MATH)) && \
!(defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__))
-# define BOOST_HASH_USE_FPCLASSIFY
+# define BOOST_HASH_USE_FPCLASSIFY 1
+# else
+# define BOOST_HASH_USE_FPCLASSIFY 0
# endif
-// Dinkumware Library, on Visual C++
-#elif (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER)
-
-// Not using _fpclass because it is only available for double.
-
+// Everything else
+#else
+# define BOOST_HASH_USE_FPCLASSIFY 0
#endif
-// On OpenBSD, numeric_limits is not reliable for long doubles, but
-// the macros defined in <float.h> are.
+#if BOOST_HASH_USE_FPCLASSIFY
-#if defined(__OpenBSD__)
-#include <float.h>
-#endif
+#include <boost/config/no_tr1/cmath.hpp>
namespace boost
{
namespace hash_detail
{
template <class T>
- struct limits : std::numeric_limits<T> {};
-
-#if defined(__OpenBSD__)
- template <>
- struct limits<long double>
- : std::numeric_limits<long double>
- {
- static long double epsilon() {
- return LDBL_EPSILON;
- }
-
- static long double (max)() {
- return LDBL_MAX;
- }
-
- static long double (min)() {
- return LDBL_MIN;
- }
-
- BOOST_STATIC_CONSTANT(int, digits = LDBL_MANT_DIG);
- BOOST_STATIC_CONSTANT(int, max_exponent = LDBL_MAX_EXP);
- BOOST_STATIC_CONSTANT(int, min_exponent = LDBL_MIN_EXP);
- };
-#endif // __OpenBSD__
-
- inline void hash_float_combine(std::size_t& seed, std::size_t value)
- {
- seed ^= value + (seed<<6) + (seed>>2);
- }
-
-// A simple, non-portable hash algorithm for x86.
-#if defined(BOOST_HASH_USE_x86_BINARY_HASH)
- inline std::size_t float_hash_impl(float v)
- {
- boost::uint32_t* ptr = (boost::uint32_t*)&v;
- std::size_t seed = *ptr;
- return seed;
- }
-
- inline std::size_t float_hash_impl(double v)
- {
- boost::uint32_t* ptr = (boost::uint32_t*)&v;
- std::size_t seed = *ptr++;
- hash_float_combine(seed, *ptr);
- return seed;
- }
-
- inline std::size_t float_hash_impl(long double v)
- {
- boost::uint32_t* ptr = (boost::uint32_t*)&v;
- std::size_t seed = *ptr++;
- hash_float_combine(seed, *ptr++);
- hash_float_combine(seed, *(boost::uint16_t*)ptr);
- return seed;
- }
-
-#else
-
- template <class T>
- inline std::size_t float_hash_impl(T v)
- {
- int exp = 0;
-
- v = boost::hash_detail::call_frexp(v, &exp);
-
- // A postive value is easier to hash, so combine the
- // sign with the exponent.
- if(v < 0) {
- v = -v;
- exp += limits<T>::max_exponent -
- limits<T>::min_exponent;
- }
-
- // The result of frexp is always between 0.5 and 1, so its
- // top bit will always be 1. Subtract by 0.5 to remove that.
- v -= T(0.5);
- v = boost::hash_detail::call_ldexp(v,
- limits<std::size_t>::digits + 1);
- std::size_t seed = static_cast<std::size_t>(v);
- v -= seed;
-
- // ceiling(digits(T) * log2(radix(T))/ digits(size_t)) - 1;
- std::size_t const length
- = (limits<T>::digits *
- boost::static_log2<limits<T>::radix>::value - 1)
- / limits<std::size_t>::digits;
-
- 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);
- v -= part;
- hash_float_combine(seed, part);
- }
-
- hash_float_combine(seed, exp);
-
- return seed;
- }
-#endif
-
- template <class T>
inline std::size_t float_hash_value(T v)
{
-#if defined(BOOST_HASH_USE_FPCLASSIFY)
using namespace std;
switch (fpclassify(v)) {
case FP_ZERO:
@@ -183,15 +76,26 @@ namespace boost
BOOST_ASSERT(0);
return 0;
}
-#else
+ }
+ }
+}
+
+#else // !BOOST_HASH_USE_FPCLASSIFY
+
+namespace boost
+{
+ namespace hash_detail
+ {
+ template <class T>
+ inline std::size_t float_hash_value(T v)
+ {
return v == 0 ? 0 : float_hash_impl(v);
-#endif
}
}
}
-#if defined(BOOST_MSVC)
-#pragma warning(pop)
-#endif
+#endif // BOOST_HASH_USE_FPCLASSIFY
+
+#undef BOOST_HASH_USE_FPCLASSIFY
#endif
diff --git a/3rdParty/Boost/src/boost/functional/hash/detail/hash_float_generic.hpp b/3rdParty/Boost/src/boost/functional/hash/detail/hash_float_generic.hpp
new file mode 100644
index 0000000..f9acee9
--- /dev/null
+++ b/3rdParty/Boost/src/boost/functional/hash/detail/hash_float_generic.hpp
@@ -0,0 +1,93 @@
+
+// Copyright 2005-2009 Daniel James.
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+// A general purpose hash function for non-zero floating point values.
+
+#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_GENERIC_HEADER)
+#define BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_GENERIC_HEADER
+
+#include <boost/functional/hash/detail/float_functions.hpp>
+#include <boost/integer/static_log2.hpp>
+#include <boost/functional/hash/detail/limits.hpp>
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#if defined(BOOST_MSVC)
+#pragma warning(push)
+#if BOOST_MSVC >= 1400
+#pragma warning(disable:6294) // Ill-defined for-loop: initial condition does
+ // not satisfy test. Loop body not executed
+#endif
+#endif
+
+namespace boost
+{
+ namespace hash_detail
+ {
+ inline void hash_float_combine(std::size_t& seed, std::size_t value)
+ {
+ seed ^= value + (seed<<6) + (seed>>2);
+ }
+
+ template <class T>
+ inline std::size_t float_hash_impl2(T v)
+ {
+ boost::hash_detail::call_frexp<T> frexp;
+ boost::hash_detail::call_ldexp<T> ldexp;
+
+ int exp = 0;
+
+ v = frexp(v, &exp);
+
+ // A postive value is easier to hash, so combine the
+ // sign with the exponent and use the absolute value.
+ if(v < 0) {
+ v = -v;
+ exp += limits<T>::max_exponent -
+ limits<T>::min_exponent;
+ }
+
+ // The result of frexp is always between 0.5 and 1, so its
+ // top bit will always be 1. Subtract by 0.5 to remove that.
+ v -= T(0.5);
+ v = ldexp(v, limits<std::size_t>::digits + 1);
+ std::size_t seed = static_cast<std::size_t>(v);
+ v -= seed;
+
+ // ceiling(digits(T) * log2(radix(T))/ digits(size_t)) - 1;
+ std::size_t const length
+ = (limits<T>::digits *
+ boost::static_log2<limits<T>::radix>::value - 1)
+ / limits<std::size_t>::digits;
+
+ for(std::size_t i = 0; i != length; ++i)
+ {
+ v = ldexp(v, limits<std::size_t>::digits);
+ std::size_t part = static_cast<std::size_t>(v);
+ v -= part;
+ hash_float_combine(seed, part);
+ }
+
+ hash_float_combine(seed, exp);
+
+ return seed;
+ }
+
+ template <class T>
+ inline std::size_t float_hash_impl(T v)
+ {
+ typedef BOOST_DEDUCED_TYPENAME select_hash_type<T>::type type;
+ return float_hash_impl2(static_cast<type>(v));
+ }
+ }
+}
+
+#if defined(BOOST_MSVC)
+#pragma warning(pop)
+#endif
+
+#endif
diff --git a/3rdParty/Boost/src/boost/functional/hash/detail/hash_float_x86.hpp b/3rdParty/Boost/src/boost/functional/hash/detail/hash_float_x86.hpp
new file mode 100644
index 0000000..b39bb0d
--- /dev/null
+++ b/3rdParty/Boost/src/boost/functional/hash/detail/hash_float_x86.hpp
@@ -0,0 +1,56 @@
+
+// Copyright 2005-2009 Daniel James.
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+// A non-portable hash function form non-zero floats on x86.
+//
+// Even if you're on an x86 platform, this might not work if their floating
+// point isn't set up as this expects. So this should only be used if it's
+// absolutely certain that it will work.
+
+#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_X86_HEADER)
+#define BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_X86_HEADER
+
+#include <boost/cstdint.hpp>
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+namespace boost
+{
+ namespace hash_detail
+ {
+ inline void hash_float_combine(std::size_t& seed, std::size_t value)
+ {
+ seed ^= value + (seed<<6) + (seed>>2);
+ }
+
+ inline std::size_t float_hash_impl(float v)
+ {
+ boost::uint32_t* ptr = (boost::uint32_t*)&v;
+ std::size_t seed = *ptr;
+ return seed;
+ }
+
+ inline std::size_t float_hash_impl(double v)
+ {
+ boost::uint32_t* ptr = (boost::uint32_t*)&v;
+ std::size_t seed = *ptr++;
+ hash_float_combine(seed, *ptr);
+ return seed;
+ }
+
+ inline std::size_t float_hash_impl(long double v)
+ {
+ boost::uint32_t* ptr = (boost::uint32_t*)&v;
+ std::size_t seed = *ptr++;
+ hash_float_combine(seed, *ptr++);
+ hash_float_combine(seed, *(boost::uint16_t*)ptr);
+ return seed;
+ }
+ }
+}
+
+#endif
diff --git a/3rdParty/Boost/src/boost/functional/hash/detail/limits.hpp b/3rdParty/Boost/src/boost/functional/hash/detail/limits.hpp
new file mode 100644
index 0000000..f5b520e
--- /dev/null
+++ b/3rdParty/Boost/src/boost/functional/hash/detail/limits.hpp
@@ -0,0 +1,61 @@
+
+// Copyright 2005-2009 Daniel James.
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// On some platforms std::limits gives incorrect values for long double.
+// This tries to work around them.
+
+#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_LIMITS_HEADER)
+#define BOOST_FUNCTIONAL_HASH_DETAIL_LIMITS_HEADER
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/limits.hpp>
+
+// On OpenBSD, numeric_limits is not reliable for long doubles, but
+// the macros defined in <float.h> are and support long double when STLport
+// doesn't.
+
+#if defined(__OpenBSD__) || defined(_STLP_NO_LONG_DOUBLE)
+#include <float.h>
+#endif
+
+namespace boost
+{
+ namespace hash_detail
+ {
+ template <class T>
+ struct limits : std::numeric_limits<T> {};
+
+#if defined(__OpenBSD__) || defined(_STLP_NO_LONG_DOUBLE)
+ template <>
+ struct limits<long double>
+ : std::numeric_limits<long double>
+ {
+ static long double epsilon() {
+ return LDBL_EPSILON;
+ }
+
+ static long double (max)() {
+ return LDBL_MAX;
+ }
+
+ static long double (min)() {
+ return LDBL_MIN;
+ }
+
+ BOOST_STATIC_CONSTANT(int, digits = LDBL_MANT_DIG);
+ BOOST_STATIC_CONSTANT(int, max_exponent = LDBL_MAX_EXP);
+ BOOST_STATIC_CONSTANT(int, min_exponent = LDBL_MIN_EXP);
+#if defined(_STLP_NO_LONG_DOUBLE)
+ BOOST_STATIC_CONSTANT(int, radix = FLT_RADIX);
+#endif
+ };
+#endif // __OpenBSD__
+ }
+}
+
+#endif
diff --git a/3rdParty/Boost/src/boost/functional/hash/extensions.hpp b/3rdParty/Boost/src/boost/functional/hash/extensions.hpp
index d173314..3c587a3 100644
--- a/3rdParty/Boost/src/boost/functional/hash/extensions.hpp
+++ b/3rdParty/Boost/src/boost/functional/hash/extensions.hpp
@@ -7,15 +7,114 @@
// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf
// issue 6.18.
+// This implements the extensions to the standard.
+// It's undocumented, so you shouldn't use it....
+
#if !defined(BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP)
#define BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP
+#include <boost/functional/hash/hash.hpp>
+#include <boost/detail/container_fwd.hpp>
+
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
+#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
+#include <boost/type_traits/is_array.hpp>
+#endif
+
+#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+#include <boost/type_traits/is_const.hpp>
+#endif
+
namespace boost
{
+ template <class A, class B>
+ std::size_t hash_value(std::pair<A, B> const&);
+ template <class T, class A>
+ std::size_t hash_value(std::vector<T, A> const&);
+ template <class T, class A>
+ std::size_t hash_value(std::list<T, A> const& v);
+ template <class T, class A>
+ std::size_t hash_value(std::deque<T, A> const& v);
+ template <class K, class C, class A>
+ std::size_t hash_value(std::set<K, C, A> const& v);
+ template <class K, class C, class A>
+ std::size_t hash_value(std::multiset<K, C, A> const& v);
+ template <class K, class T, class C, class A>
+ std::size_t hash_value(std::map<K, T, C, A> const& v);
+ template <class K, class T, class C, class A>
+ std::size_t hash_value(std::multimap<K, T, C, A> const& v);
+
+ template <class T>
+ std::size_t hash_value(std::complex<T> const&);
+
+ template <class A, class B>
+ std::size_t hash_value(std::pair<A, B> const& v)
+ {
+ std::size_t seed = 0;
+ hash_combine(seed, v.first);
+ hash_combine(seed, v.second);
+ return seed;
+ }
+
+ template <class T, class A>
+ std::size_t hash_value(std::vector<T, A> const& v)
+ {
+ return hash_range(v.begin(), v.end());
+ }
+
+ template <class T, class A>
+ std::size_t hash_value(std::list<T, A> const& v)
+ {
+ return hash_range(v.begin(), v.end());
+ }
+
+ template <class T, class A>
+ std::size_t hash_value(std::deque<T, A> const& v)
+ {
+ return hash_range(v.begin(), v.end());
+ }
+
+ template <class K, class C, class A>
+ std::size_t hash_value(std::set<K, C, A> const& v)
+ {
+ return hash_range(v.begin(), v.end());
+ }
+
+ template <class K, class C, class A>
+ std::size_t hash_value(std::multiset<K, C, A> const& v)
+ {
+ return hash_range(v.begin(), v.end());
+ }
+
+ template <class K, class T, class C, class A>
+ std::size_t hash_value(std::map<K, T, C, A> const& v)
+ {
+ return hash_range(v.begin(), v.end());
+ }
+
+ template <class K, class T, class C, class A>
+ std::size_t hash_value(std::multimap<K, T, C, A> const& v)
+ {
+ return hash_range(v.begin(), v.end());
+ }
+
+ template <class T>
+ std::size_t hash_value(std::complex<T> const& v)
+ {
+ boost::hash<T> hasher;
+ std::size_t seed = hasher(v.imag());
+ seed ^= hasher(v.real()) + (seed<<6) + (seed>>2);
+ return seed;
+ }
+
+ //
+ // call_hash_impl
+ //
+
+ // On compilers without function template ordering, this deals with arrays.
#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
namespace hash_detail
@@ -61,6 +160,11 @@ namespace boost
}
#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
+ //
+ // boost::hash
+ //
+
+
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
template <class T> struct hash
@@ -94,7 +198,7 @@ namespace boost
// On compilers without partial specialization, boost::hash<T>
// has already been declared to deal with pointers, so just
- // need to supply the non-pointer version.
+ // need to supply the non-pointer version of hash_impl.
namespace hash_detail
{
@@ -126,8 +230,8 @@ namespace boost
#else // Visual C++ 6.5
- // There's probably a more elegant way to Visual C++ 6.5 to work
- // but I don't know what it is.
+ // Visual C++ 6.5 has problems with nested member functions and
+ // applying const to const types in templates. So we get this:
template <bool IsConst>
struct hash_impl_msvc
diff --git a/3rdParty/Boost/src/boost/functional/hash/hash.hpp b/3rdParty/Boost/src/boost/functional/hash/hash.hpp
index 67284fc..1f33b9e 100644
--- a/3rdParty/Boost/src/boost/functional/hash/hash.hpp
+++ b/3rdParty/Boost/src/boost/functional/hash/hash.hpp
@@ -13,19 +13,18 @@
#include <boost/functional/hash/hash_fwd.hpp>
#include <functional>
#include <boost/functional/hash/detail/hash_float.hpp>
-#include <boost/detail/container_fwd.hpp>
#include <string>
+#include <boost/limits.hpp>
#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
#include <boost/type_traits/is_pointer.hpp>
#endif
-#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
-#include <boost/type_traits/is_array.hpp>
-#endif
-
-#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
-#include <boost/type_traits/is_const.hpp>
+#if BOOST_WORKAROUND(__GNUC__, < 3) \
+ && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
+#define BOOST_HASH_CHAR_TRAITS string_char_traits
+#else
+#define BOOST_HASH_CHAR_TRAITS char_traits
#endif
namespace boost
@@ -69,27 +68,8 @@ namespace boost
std::size_t hash_value(long double v);
template <class Ch, class A>
- std::size_t hash_value(std::basic_string<Ch, std::BOOST_HASH_CHAR_TRAITS<Ch>, A> const&);
-
- template <class A, class B>
- std::size_t hash_value(std::pair<A, B> const&);
- template <class T, class A>
- std::size_t hash_value(std::vector<T, A> const&);
- template <class T, class A>
- std::size_t hash_value(std::list<T, A> const& v);
- template <class T, class A>
- std::size_t hash_value(std::deque<T, A> const& v);
- template <class K, class C, class A>
- std::size_t hash_value(std::set<K, C, A> const& v);
- template <class K, class C, class A>
- std::size_t hash_value(std::multiset<K, C, A> const& v);
- template <class K, class T, class C, class A>
- std::size_t hash_value(std::map<K, T, C, A> const& v);
- template <class K, class T, class C, class A>
- std::size_t hash_value(std::multimap<K, T, C, A> const& v);
-
- template <class T>
- std::size_t hash_value(std::complex<T> const&);
+ std::size_t hash_value(
+ std::basic_string<Ch, std::BOOST_HASH_CHAR_TRAITS<Ch>, A> const&);
// Implementation
@@ -219,6 +199,16 @@ namespace boost
return x + (x >> 3);
}
+#if defined(BOOST_MSVC)
+#pragma warning(push)
+#if BOOST_MSVC <= 1400
+#pragma warning(disable:4267) // 'argument' : conversion from 'size_t' to
+ // 'unsigned int', possible loss of data
+ // A misguided attempt to detect 64-bit
+ // incompatability.
+#endif
+#endif
+
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
template <class T>
inline void hash_combine(std::size_t& seed, T& v)
@@ -231,6 +221,10 @@ namespace boost
seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2);
}
+#if defined(BOOST_MSVC)
+#pragma warning(pop)
+#endif
+
template <class It>
inline std::size_t hash_range(It first, It last)
{
@@ -294,7 +288,8 @@ namespace boost
#endif
template <class Ch, class A>
- inline std::size_t hash_value(std::basic_string<Ch, std::BOOST_HASH_CHAR_TRAITS<Ch>, A> const& v)
+ inline std::size_t hash_value(
+ std::basic_string<Ch, std::BOOST_HASH_CHAR_TRAITS<Ch>, A> const& v)
{
return hash_range(v.begin(), v.end());
}
@@ -314,69 +309,21 @@ namespace boost
return boost::hash_detail::float_hash_value(v);
}
- template <class A, class B>
- std::size_t hash_value(std::pair<A, B> const& v)
- {
- std::size_t seed = 0;
- hash_combine(seed, v.first);
- hash_combine(seed, v.second);
- return seed;
- }
-
- template <class T, class A>
- std::size_t hash_value(std::vector<T, A> const& v)
- {
- return hash_range(v.begin(), v.end());
- }
-
- template <class T, class A>
- std::size_t hash_value(std::list<T, A> const& v)
- {
- return hash_range(v.begin(), v.end());
- }
-
- template <class T, class A>
- std::size_t hash_value(std::deque<T, A> const& v)
- {
- return hash_range(v.begin(), v.end());
- }
-
- template <class K, class C, class A>
- std::size_t hash_value(std::set<K, C, A> const& v)
- {
- return hash_range(v.begin(), v.end());
- }
-
- template <class K, class C, class A>
- std::size_t hash_value(std::multiset<K, C, A> const& v)
- {
- return hash_range(v.begin(), v.end());
- }
-
- template <class K, class T, class C, class A>
- std::size_t hash_value(std::map<K, T, C, A> const& v)
- {
- return hash_range(v.begin(), v.end());
- }
-
- template <class K, class T, class C, class A>
- std::size_t hash_value(std::multimap<K, T, C, A> const& v)
- {
- return hash_range(v.begin(), v.end());
- }
-
- template <class T>
- std::size_t hash_value(std::complex<T> const& v)
- {
- boost::hash<T> hasher;
- std::size_t seed = hasher(v.imag());
- seed ^= hasher(v.real()) + (seed<<6) + (seed>>2);
- return seed;
- }
-
//
// boost::hash
//
+
+ // Define the specializations required by the standard. The general purpose
+ // boost::hash is defined later in extensions.hpp if
+ // BOOST_HASH_NO_EXTENSIONS is not defined.
+
+ // BOOST_HASH_SPECIALIZE - define a specialization for a type which is
+ // passed by copy.
+ //
+ // BOOST_HASH_SPECIALIZE_REF - define a specialization for a type which is
+ // passed by copy.
+ //
+ // These are undefined later.
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
#define BOOST_HASH_SPECIALIZE(type) \
@@ -461,10 +408,18 @@ namespace boost
BOOST_HASH_SPECIALIZE_REF(std::wstring)
#endif
+#if defined(BOOST_HAS_LONG_LONG)
+ BOOST_HASH_SPECIALIZE(boost::long_long_type)
+ BOOST_HASH_SPECIALIZE(boost::ulong_long_type)
+#endif
+
#undef BOOST_HASH_SPECIALIZE
#undef BOOST_HASH_SPECIALIZE_REF
+// Specializing boost::hash for pointers.
+
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
+
template <class T>
struct hash<T*>
: public std::unary_function<T*, std::size_t>
@@ -481,7 +436,15 @@ namespace boost
#endif
}
};
+
#else
+
+ // For compilers without partial specialization, we define a
+ // boost::hash for all remaining types. But hash_impl is only defined
+ // for pointers in 'extensions.hpp' - so when BOOST_HASH_NO_EXTENSIONS
+ // is defined there will still be a compile error for types not supported
+ // in the standard.
+
namespace hash_detail
{
template <bool IsPointer>
@@ -514,9 +477,12 @@ namespace boost
::BOOST_NESTED_TEMPLATE inner<T>
{
};
+
#endif
}
+#undef BOOST_HASH_CHAR_TRAITS
+
#endif // BOOST_FUNCTIONAL_HASH_HASH_HPP
// Include this outside of the include guards in case the file is included