Unverified Commit 0a24a071 authored by Vladislav Shchapov's avatar Vladislav Shchapov Committed by GitHub

Clz builtin may be not constexpr (Issue #2761) (#2762)

parent ba6f89c7
...@@ -991,7 +991,7 @@ FMT_CONSTEXPR20 inline auto count_digits(uint64_t n) -> int { ...@@ -991,7 +991,7 @@ FMT_CONSTEXPR20 inline auto count_digits(uint64_t n) -> int {
template <int BITS, typename UInt> template <int BITS, typename UInt>
FMT_CONSTEXPR auto count_digits(UInt n) -> int { FMT_CONSTEXPR auto count_digits(UInt n) -> int {
#ifdef FMT_BUILTIN_CLZ #ifdef FMT_BUILTIN_CLZ
if (num_bits<UInt>() == 32) if (!is_constant_evaluated() && num_bits<UInt>() == 32)
return (FMT_BUILTIN_CLZ(static_cast<uint32_t>(n) | 1) ^ 31) / BITS + 1; return (FMT_BUILTIN_CLZ(static_cast<uint32_t>(n) | 1) ^ 31) / BITS + 1;
#endif #endif
// Lambda avoids unreachable code warnings from NVHPC. // Lambda avoids unreachable code warnings from NVHPC.
......
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