Commit 188138fa by Abseil Team Committed by Copybara-Service

Change bit_width(T) to return int rather than T.

This matches std::bit_width().

Bug: chromium:1292951
PiperOrigin-RevId: 468495319
Change-Id: I0e428addb6a7353abbf2063c5c2f5820c3bae789
parent d06b89b2
......@@ -131,10 +131,9 @@ 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, T>::type
typename std::enable_if<std::is_unsigned<T>::value, int>::type
bit_width(T x) noexcept {
return std::numeric_limits<T>::digits -
static_cast<unsigned int>(countl_zero(x));
return std::numeric_limits<T>::digits - countl_zero(x);
}
// Returns: If x == 0, 0; otherwise the maximal value y such that
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment