Skip to content

Commit

Permalink
Clz builtin may be not constexpr (Issue #2761)
Browse files Browse the repository at this point in the history
  • Loading branch information
phprus committed Feb 14, 2022
1 parent a44716f commit 2b4a858
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,7 @@ FMT_CONSTEXPR20 inline auto count_digits(uint64_t n) -> int {
template <int BITS, typename UInt>
FMT_CONSTEXPR auto count_digits(UInt n) -> int {
#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;
#endif
// Lambda avoids unreachable code warnings from NVHPC.
Expand Down

0 comments on commit 2b4a858

Please sign in to comment.