From 5fcfd1ae384760a78e5c8b151569f42a769f4780 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Mon, 10 Dec 2012 10:40:44 +0000 Subject: [PATCH] Hash: Support boost::int128_type. [SVN r81816] --- hash/test/hash_number_test.cpp | 5 +++++ include/boost/functional/hash/hash.hpp | 20 ++++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/hash/test/hash_number_test.cpp b/hash/test/hash_number_test.cpp index b7083c9..e4555e3 100644 --- a/hash/test/hash_number_test.cpp +++ b/hash/test/hash_number_test.cpp @@ -175,6 +175,11 @@ int main() NUMERIC_TEST_NO_LIMITS(boost::ulong_long_type, ulong_long) #endif +#if defined(BOOST_HAS_INT128) + NUMERIC_TEST_NO_LIMITS(boost::int128_type, int128) + NUMERIC_TEST_NO_LIMITS(boost::uint128_type, uint128) +#endif + NUMERIC_TEST(float, float) NUMERIC_TEST(double, double) diff --git a/include/boost/functional/hash/hash.hpp b/include/boost/functional/hash/hash.hpp index 1fc5566..24318c8 100644 --- a/include/boost/functional/hash/hash.hpp +++ b/include/boost/functional/hash/hash.hpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) @@ -40,8 +41,8 @@ namespace boost struct enable_hash_value { typedef std::size_t type; }; template struct basic_numbers {}; - template struct long_numbers {}; - template struct ulong_numbers {}; + template struct long_numbers; + template struct ulong_numbers; template struct float_numbers {}; template <> struct basic_numbers : @@ -70,6 +71,14 @@ namespace boost boost::hash_detail::enable_hash_value {}; #endif + // long_numbers is defined like this to allow for separate + // specialization for long_long and int128_type, in case + // they conflict. + template struct long_numbers2 {}; + template struct ulong_numbers2 {}; + template struct long_numbers : long_numbers2 {}; + template struct ulong_numbers : long_numbers2 {}; + #if !defined(BOOST_NO_LONG_LONG) template <> struct long_numbers : boost::hash_detail::enable_hash_value {}; @@ -77,6 +86,13 @@ namespace boost boost::hash_detail::enable_hash_value {}; #endif +#if defined(BOOST_HAS_INT128) + template <> struct long_numbers2 : + boost::hash_detail::enable_hash_value {}; + template <> struct ulong_numbers2 : + boost::hash_detail::enable_hash_value {}; +#endif + template <> struct float_numbers : boost::hash_detail::enable_hash_value {}; template <> struct float_numbers :