123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- #ifndef BOOST_UNORDERED_DETAIL_XMX_HPP
- #define BOOST_UNORDERED_DETAIL_XMX_HPP
- #include <boost/cstdint.hpp>
- #include <climits>
- #include <cstddef>
- namespace boost{
- namespace unordered{
- namespace detail{
- #if defined(SIZE_MAX)
- #if ((((SIZE_MAX >> 16) >> 16) >> 16) >> 15) != 0
- #define BOOST_UNORDERED_64B_ARCHITECTURE
- #endif
- #elif defined(UINTPTR_MAX)
- #if ((((UINTPTR_MAX >> 16) >> 16) >> 16) >> 15) != 0
- #define BOOST_UNORDERED_64B_ARCHITECTURE
- #endif
- #endif
- static inline std::size_t xmx(std::size_t x)noexcept
- {
- #if defined(BOOST_UNORDERED_64B_ARCHITECTURE)
- boost::uint64_t z=(boost::uint64_t)x;
- z^=z>>23;
- z*=0xff51afd7ed558ccdull;
- z^=z>>23;
- return (std::size_t)z;
- #else
- x^=x>>18;
- x*=0x56b5aaadu;
- x^=x>>16;
- return x;
- #endif
- }
- #ifdef BOOST_UNORDERED_64B_ARCHITECTURE
- #undef BOOST_UNORDERED_64B_ARCHITECTURE
- #endif
- }
- }
- }
- #endif
|