diff --git a/include/boost/core/bit.hpp b/include/boost/core/bit.hpp index f4305b9..7efb7c7 100644 --- a/include/boost/core/bit.hpp +++ b/include/boost/core/bit.hpp @@ -446,10 +446,13 @@ BOOST_CONSTEXPR bool has_single_bit( T x ) BOOST_NOEXCEPT return x != 0 && ( x & ( x - 1 ) ) == 0; } +// bit_width should return int, https://cplusplus.github.io/LWG/issue3656 + template BOOST_CONSTEXPR T bit_width( T x ) BOOST_NOEXCEPT { - return std::numeric_limits::digits - boost::core::countl_zero( x ); + return static_cast( + std::numeric_limits::digits - boost::core::countl_zero( x ) ); } template