diff --git a/include/boost/unordered/detail/prime_fmod.hpp b/include/boost/unordered/detail/prime_fmod.hpp index 879fcc7c..8806bb44 100644 --- a/include/boost/unordered/detail/prime_fmod.hpp +++ b/include/boost/unordered/detail/prime_fmod.hpp @@ -50,7 +50,7 @@ namespace boost { static std::size_t (*positions[])(std::size_t); #if defined(BOOST_UNORDERED_FCA_HAS_64B_SIZE_T) - static uint64_t inv_sizes32[]; + static boost::uint64_t inv_sizes32[]; static std::size_t const inv_sizes32_len; #endif /* defined(BOOST_UNORDERED_FCA_HAS_64B_SIZE_T) */ @@ -85,30 +85,32 @@ namespace boost { // modulo) exploiting how compilers transform division // - static inline uint64_t get_remainder(uint64_t fractional, uint32_t d) + static inline boost::uint64_t get_remainder( + boost::uint64_t fractional, boost::uint32_t d) { #if defined(_MSC_VER) // use MSVC intrinsics when available to avoid promotion to 128 bits return __umulh(fractional, d); #elif defined(BOOST_HAS_INT128) - return static_cast( + return static_cast( ((boost::uint128_type)fractional * d) >> 64); #else // portable implementation in the absence of boost::uint128_type on 64 // bits, which happens at least in GCC 4.5 and prior - uint64_t r1 = (fractional & UINT32_MAX) * d; - uint64_t r2 = (fractional >> 32) * d; + boost::uint64_t r1 = (fractional & UINT32_MAX) * d; + boost::uint64_t r2 = (fractional >> 32) * d; r2 += r1 >> 32; return r2 >> 32; #endif /* defined(_MSC_VER) */ } - static inline uint32_t fast_modulo(uint32_t a, uint64_t M, uint32_t d) + static inline boost::uint32_t fast_modulo( + boost::uint32_t a, boost::uint64_t M, boost::uint32_t d) { - uint64_t fractional = M * a; - return (uint32_t)(get_remainder(fractional, d)); + boost::uint64_t fractional = M * a; + return (boost::uint32_t)(get_remainder(fractional, d)); } #endif /* defined(BOOST_UNORDERED_FCA_HAS_64B_SIZE_T) */ @@ -118,8 +120,9 @@ namespace boost { #if defined(BOOST_UNORDERED_FCA_HAS_64B_SIZE_T) std::size_t sizes_under_32bit = inv_sizes32_len; if (BOOST_LIKELY(size_index < sizes_under_32bit)) { - return fast_modulo(uint32_t(hash) + uint32_t(hash >> 32), - inv_sizes32[size_index], uint32_t(sizes[size_index])); + return fast_modulo( + boost::uint32_t(hash) + boost::uint32_t(hash >> 32), + inv_sizes32[size_index], boost::uint32_t(sizes[size_index])); } else { return positions[size_index - sizes_under_32bit](hash); } @@ -196,7 +199,7 @@ namespace boost { #if defined(BOOST_UNORDERED_FCA_HAS_64B_SIZE_T) // clang-format off template - uint64_t prime_fmod_size::inv_sizes32[] = { + boost::uint64_t prime_fmod_size::inv_sizes32[] = { (boost::ulong_long_type(330382099ul) << 32) + boost::ulong_long_type(2973438898ul) /* = 1418980313362273202 */, (boost::ulong_long_type(148102320ul) << 32) + boost::ulong_long_type(2369637129ul) /* = 636094623231363849 */, (boost::ulong_long_type(81037118ul) << 32) + boost::ulong_long_type(3403558990ul) /* = 348051774975651918 */,