From ec220be0c019519219a93565ee6cdd1c20f3f23a Mon Sep 17 00:00:00 2001 From: Olli Lupton Date: Thu, 4 Nov 2021 10:29:21 +0100 Subject: [PATCH] Cleanup warnings with nvhpc/21.9. --- include/fmt/core.h | 2 +- include/fmt/format.h | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index 8e8d2f1c..897b52db 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -279,7 +279,7 @@ // Enable minimal optimizations for more compact code in debug mode. FMT_GCC_PRAGMA("GCC push_options") -#ifndef __OPTIMIZE__ +#if !defined(__OPTIMIZE__) && !defined(__NVCOMPILER) FMT_GCC_PRAGMA("GCC optimize(\"Og\")") #endif diff --git a/include/fmt/format.h b/include/fmt/format.h index c4c9321d..f6a283ad 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -967,14 +967,17 @@ FMT_CONSTEXPR20 inline auto count_digits(uint64_t n) -> int { template FMT_CONSTEXPR auto count_digits(UInt n) -> int { #ifdef FMT_BUILTIN_CLZ - if (num_bits() == 32) + if (num_bits() == 32) { return (FMT_BUILTIN_CLZ(static_cast(n) | 1) ^ 31) / BITS + 1; + } else #endif - int num_digits = 0; - do { - ++num_digits; - } while ((n >>= BITS) != 0); - return num_digits; + { + int num_digits = 0; + do { + ++num_digits; + } while ((n >>= BITS) != 0); + return num_digits; + } } template <> auto count_digits<4>(detail::fallback_uintptr n) -> int;