diff --git a/include/boost/intrusive/detail/utilities.hpp b/include/boost/intrusive/detail/utilities.hpp index 4b4ee33..2e018c9 100644 --- a/include/boost/intrusive/detail/utilities.hpp +++ b/include/boost/intrusive/detail/utilities.hpp @@ -515,33 +515,35 @@ inline std::size_t ceil_log2 (std::size_t x) return ((x & (x-1))!= 0) + floor_log2(x); } -template +template +struct numbits_eq +{ + static const bool value = sizeof(SizeType)*CHAR_BIT == N; +}; + +template struct sqrt2_pow_max; -template<> -struct sqrt2_pow_max<32> +template +struct sqrt2_pow_max >::type> { static const boost::uint32_t value = 0xb504f334; static const std::size_t pow = 31; }; -#ifdef BOOST_HAS_LONG_LONG - -template<> -struct sqrt2_pow_max<64> +template +struct sqrt2_pow_max >::type> { static const boost::uint64_t value = 0xb504f333f9de6484ull; static const std::size_t pow = 63; }; -#endif - // Returns floor(pow(sqrt(2), x * 2 + 1)). // Defined for X from 0 up to the number of bits in size_t minus 1. inline std::size_t sqrt2_pow_2xplus1 (std::size_t x) { - const std::size_t value = (std::size_t)sqrt2_pow_max::value; - const std::size_t pow = (std::size_t)sqrt2_pow_max::pow; + const std::size_t value = (std::size_t)sqrt2_pow_max::value; + const std::size_t pow = (std::size_t)sqrt2_pow_max::pow; return (value >> (pow - x)) + 1; }