diff options
author | robot-contrib <robot-contrib@yandex-team.com> | 2022-08-08 17:26:32 +0300 |
---|---|---|
committer | robot-contrib <robot-contrib@yandex-team.com> | 2022-08-08 17:26:32 +0300 |
commit | f1fd089af7313d638ec11bb409a57c024bf32fa5 (patch) | |
tree | 3a92ec4135589dfc28d2239bc80f00dfb4423065 | |
parent | dcc7af40b4a3c36f67fb1dca7c8d839a824a1598 (diff) | |
download | ydb-f1fd089af7313d638ec11bb409a57c024bf32fa5.tar.gz |
Update contrib/restricted/boost/container_hash to 1.79.0
3 files changed, 47 insertions, 94 deletions
diff --git a/contrib/restricted/boost/container_hash/include/boost/container_hash/extensions.hpp b/contrib/restricted/boost/container_hash/include/boost/container_hash/extensions.hpp index 4eebb4bc93..aa4f9cff8b 100644 --- a/contrib/restricted/boost/container_hash/include/boost/container_hash/extensions.hpp +++ b/contrib/restricted/boost/container_hash/include/boost/container_hash/extensions.hpp @@ -22,7 +22,6 @@ #include <boost/detail/container_fwd.hpp> #include <boost/core/enable_if.hpp> #include <boost/static_assert.hpp> -#include <vector> #if !defined(BOOST_NO_CXX11_HDR_ARRAY) # include <array> @@ -32,9 +31,7 @@ # include <tuple> #endif -#if !defined(BOOST_NO_CXX11_HDR_MEMORY) -# include <memory> -#endif +#include <memory> #if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) #include <boost/type_traits/is_array.hpp> @@ -71,56 +68,6 @@ namespace boost return seed; } - inline std::size_t hash_range( - std::vector<bool>::iterator first, - std::vector<bool>::iterator last) - { - std::size_t seed = 0; - - for(; first != last; ++first) - { - hash_combine<bool>(seed, *first); - } - - return seed; - } - - inline std::size_t hash_range( - std::vector<bool>::const_iterator first, - std::vector<bool>::const_iterator last) - { - std::size_t seed = 0; - - for(; first != last; ++first) - { - hash_combine<bool>(seed, *first); - } - - return seed; - } - - inline void hash_range( - std::size_t& seed, - std::vector<bool>::iterator first, - std::vector<bool>::iterator last) - { - for(; first != last; ++first) - { - hash_combine<bool>(seed, *first); - } - } - - inline void hash_range( - std::size_t& seed, - std::vector<bool>::const_iterator first, - std::vector<bool>::const_iterator last) - { - for(; first != last; ++first) - { - hash_combine<bool>(seed, *first); - } - } - template <class T, class A> std::size_t hash_value(std::vector<T, A> const& v) { diff --git a/contrib/restricted/boost/container_hash/include/boost/container_hash/hash.hpp b/contrib/restricted/boost/container_hash/include/boost/container_hash/hash.hpp index 76de7939eb..5ce09d4eb6 100644 --- a/contrib/restricted/boost/container_hash/include/boost/container_hash/hash.hpp +++ b/contrib/restricted/boost/container_hash/include/boost/container_hash/hash.hpp @@ -18,6 +18,7 @@ #include <boost/container_hash/hash_fwd.hpp> #include <functional> +#include <iterator> #include <boost/container_hash/detail/hash_float.hpp> #include <string> #include <boost/limits.hpp> @@ -25,6 +26,7 @@ #include <boost/type_traits/is_integral.hpp> #include <boost/core/enable_if.hpp> #include <boost/cstdint.hpp> +#include <climits> #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) #include <boost/type_traits/is_pointer.hpp> @@ -118,7 +120,7 @@ namespace boost { namespace hash_detail { -#if defined(_HAS_AUTO_PTR_ETC) && !_HAS_AUTO_PTR_ETC +#if defined(BOOST_NO_CXX98_FUNCTION_BASE) template <typename T> struct hash_base { @@ -306,52 +308,56 @@ namespace boost return seed; } - template <typename SizeT> - inline void hash_combine_impl(SizeT& seed, SizeT value) + template<std::size_t Bits> struct hash_combine_impl { - seed ^= value + 0x9e3779b9 + (seed<<6) + (seed>>2); - } + template <typename SizeT> + inline static SizeT fn(SizeT seed, SizeT value) + { + seed ^= value + 0x9e3779b9 + (seed<<6) + (seed>>2); + return seed; + } + }; - inline void hash_combine_impl(boost::uint32_t& h1, - boost::uint32_t k1) + template<> struct hash_combine_impl<32> { - const uint32_t c1 = 0xcc9e2d51; - const uint32_t c2 = 0x1b873593; - - k1 *= c1; - k1 = BOOST_FUNCTIONAL_HASH_ROTL32(k1,15); - k1 *= c2; + inline static boost::uint32_t fn(boost::uint32_t h1, boost::uint32_t k1) + { + const boost::uint32_t c1 = 0xcc9e2d51; + const boost::uint32_t c2 = 0x1b873593; - h1 ^= k1; - h1 = BOOST_FUNCTIONAL_HASH_ROTL32(h1,13); - h1 = h1*5+0xe6546b64; - } + k1 *= c1; + k1 = BOOST_FUNCTIONAL_HASH_ROTL32(k1,15); + k1 *= c2; + h1 ^= k1; + h1 = BOOST_FUNCTIONAL_HASH_ROTL32(h1,13); + h1 = h1*5+0xe6546b64; -// Don't define 64-bit hash combine on platforms without 64 bit integers, -// and also not for 32-bit gcc as it warns about the 64-bit constant. -#if !defined(BOOST_NO_INT64_T) && \ - !(defined(__GNUC__) && ULONG_MAX == 0xffffffff) + return h1; + } + }; - inline void hash_combine_impl(boost::uint64_t& h, - boost::uint64_t k) + template<> struct hash_combine_impl<64> { - const boost::uint64_t m = UINT64_C(0xc6a4a7935bd1e995); - const int r = 47; + inline static boost::uint64_t fn(boost::uint64_t h, boost::uint64_t k) + { + const boost::uint64_t m = (boost::uint64_t(0xc6a4a793) << 32) + 0x5bd1e995; + const int r = 47; - k *= m; - k ^= k >> r; - k *= m; + k *= m; + k ^= k >> r; + k *= m; - h ^= k; - h *= m; + h ^= k; + h *= m; - // Completely arbitrary number, to prevent 0's - // from hashing to 0. - h += 0xe6546b64; - } + // Completely arbitrary number, to prevent 0's + // from hashing to 0. + h += 0xe6546b64; -#endif // BOOST_NO_INT64_T + return h; + } + }; } template <typename T> @@ -412,7 +418,7 @@ namespace boost inline void hash_combine(std::size_t& seed, T const& v) { boost::hash<T> hasher; - return boost::hash_detail::hash_combine_impl(seed, hasher(v)); + seed = boost::hash_detail::hash_combine_impl<sizeof(std::size_t) * CHAR_BIT>::fn(seed, hasher(v)); } #if defined(BOOST_MSVC) @@ -426,7 +432,7 @@ namespace boost for(; first != last; ++first) { - hash_combine(seed, *first); + hash_combine<typename std::iterator_traits<It>::value_type>(seed, *first); } return seed; @@ -437,11 +443,11 @@ namespace boost { for(; first != last; ++first) { - hash_combine(seed, *first); + hash_combine<typename std::iterator_traits<It>::value_type>(seed, *first); } } -#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) +#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551)) template <class T> inline std::size_t hash_range(T* first, T* last) { diff --git a/contrib/restricted/boost/container_hash/include/boost/container_hash/hash_fwd.hpp b/contrib/restricted/boost/container_hash/include/boost/container_hash/hash_fwd.hpp index a87c182d39..46340b3f4a 100644 --- a/contrib/restricted/boost/container_hash/include/boost/container_hash/hash_fwd.hpp +++ b/contrib/restricted/boost/container_hash/include/boost/container_hash/hash_fwd.hpp @@ -27,7 +27,7 @@ namespace boost template <class It> std::size_t hash_range(It, It); template <class It> void hash_range(std::size_t&, It, It); -#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) +#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551)) template <class T> inline std::size_t hash_range(T*, T*); template <class T> inline void hash_range(std::size_t&, T*, T*); #endif |