Clz builtin may be not constexpr (Issue #2761)
This commit is contained in:
parent
a44716f58e
commit
2b4a858f0d
@ -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.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user