diff options
Diffstat (limited to 'absl/numeric/bits.h')
-rw-r--r-- | absl/numeric/bits.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/absl/numeric/bits.h b/absl/numeric/bits.h index df81b9a9..628cdf50 100644 --- a/absl/numeric/bits.h +++ b/absl/numeric/bits.h @@ -131,9 +131,10 @@ has_single_bit(T x) noexcept { // fractional part discarded. template <class T> ABSL_INTERNAL_CONSTEXPR_CLZ inline - typename std::enable_if<std::is_unsigned<T>::value, int>::type + typename std::enable_if<std::is_unsigned<T>::value, T>::type bit_width(T x) noexcept { - return std::numeric_limits<T>::digits - countl_zero(x); + return std::numeric_limits<T>::digits - + static_cast<unsigned int>(countl_zero(x)); } // Returns: If x == 0, 0; otherwise the maximal value y such that |