File indexing completed on 2025-02-22 10:30:09
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef BOOST_UNORDERED_DETAIL_XMX_HPP
0013 #define BOOST_UNORDERED_DETAIL_XMX_HPP
0014
0015 #include <boost/cstdint.hpp>
0016 #include <climits>
0017 #include <cstddef>
0018
0019 namespace boost{
0020 namespace unordered{
0021 namespace detail{
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034 #if defined(SIZE_MAX)
0035 #if ((((SIZE_MAX >> 16) >> 16) >> 16) >> 15) != 0
0036 #define BOOST_UNORDERED_64B_ARCHITECTURE
0037 #endif
0038 #elif defined(UINTPTR_MAX)
0039 #if ((((UINTPTR_MAX >> 16) >> 16) >> 16) >> 15) != 0
0040 #define BOOST_UNORDERED_64B_ARCHITECTURE
0041 #endif
0042 #endif
0043
0044 static inline std::size_t xmx(std::size_t x)noexcept
0045 {
0046 #if defined(BOOST_UNORDERED_64B_ARCHITECTURE)
0047
0048 boost::uint64_t z=(boost::uint64_t)x;
0049
0050 z^=z>>23;
0051 z*=0xff51afd7ed558ccdull;
0052 z^=z>>23;
0053
0054 return (std::size_t)z;
0055
0056 #else
0057
0058 x^=x>>18;
0059 x*=0x56b5aaadu;
0060 x^=x>>16;
0061
0062 return x;
0063
0064 #endif
0065 }
0066
0067 #ifdef BOOST_UNORDERED_64B_ARCHITECTURE
0068 #undef BOOST_UNORDERED_64B_ARCHITECTURE
0069 #endif
0070
0071 }
0072 }
0073 }
0074
0075 #endif