mirror of
https://github.com/fmtlib/fmt.git
synced 2025-11-28 21:30:00 +01:00
Cleanup warnings with nvhpc/21.9. (#2582)
* Cleanup warnings with nvhpc/21.9. * Move __NVCOMPILER check. * Be more explicit. * Immediately executed lambda. * Fix shadowing warning.
This commit is contained in:
@@ -970,11 +970,14 @@ FMT_CONSTEXPR auto count_digits(UInt n) -> int {
|
||||
if (num_bits<UInt>() == 32)
|
||||
return (FMT_BUILTIN_CLZ(static_cast<uint32_t>(n) | 1) ^ 31) / BITS + 1;
|
||||
#endif
|
||||
int num_digits = 0;
|
||||
do {
|
||||
++num_digits;
|
||||
} while ((n >>= BITS) != 0);
|
||||
return num_digits;
|
||||
// Lambda avoids unreachable code warnings from NVHPC.
|
||||
return [](UInt m) {
|
||||
int num_digits = 0;
|
||||
do {
|
||||
++num_digits;
|
||||
} while ((m >>= BITS) != 0);
|
||||
return num_digits;
|
||||
}(n);
|
||||
}
|
||||
|
||||
template <> auto count_digits<4>(detail::fallback_uintptr n) -> int;
|
||||
|
||||
Reference in New Issue
Block a user