From 0f87d6ffa699e8135206c15aaed560ab67f685f5 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Wed, 17 Jul 2024 14:29:19 -0700 Subject: [PATCH] Improve sign processing --- include/fmt/format.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index 4f3d4a79..d2707350 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -1120,7 +1120,7 @@ template constexpr auto sign(Sign s) -> Char { #if !FMT_GCC_VERSION || FMT_GCC_VERSION >= 604 static_assert(std::is_same::value, ""); #endif - return static_cast("\0-+ "[s]); + return static_cast(((' ' << 24) | ('+' << 16) | ('-' << 8)) >> (s * 8)); } template FMT_CONSTEXPR auto count_digits_fallback(T n) -> int {