diff options
Diffstat (limited to 'absl/numeric/bits.h')
-rw-r--r-- | absl/numeric/bits.h | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/absl/numeric/bits.h b/absl/numeric/bits.h index 628cdf50..5ed36f52 100644 --- a/absl/numeric/bits.h +++ b/absl/numeric/bits.h @@ -38,19 +38,19 @@ #include <limits> #include <type_traits> -#if (defined(__cpp_lib_int_pow2) && __cpp_lib_int_pow2 >= 202002L) || \ - (defined(__cpp_lib_bitops) && __cpp_lib_bitops >= 201907L) +#include "absl/base/config.h" + +#if ABSL_INTERNAL_CPLUSPLUS_LANG >= 202002L #include <bit> #endif #include "absl/base/attributes.h" -#include "absl/base/config.h" #include "absl/numeric/internal/bits.h" namespace absl { ABSL_NAMESPACE_BEGIN - #if !(defined(__cpp_lib_bitops) && __cpp_lib_bitops >= 201907L) + // rotating template <class T> ABSL_MUST_USE_RESULT constexpr @@ -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 |