From 7477dda28ddc166b6e4edb0f96abf295fb1c44b0 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Thu, 29 Aug 2024 14:39:26 -0700 Subject: [PATCH] Simplify is_utf8_enabled --- include/fmt/base.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/include/fmt/base.h b/include/fmt/base.h index 2605bed6..29d0bc4c 100644 --- a/include/fmt/base.h +++ b/include/fmt/base.h @@ -478,12 +478,7 @@ struct is_std_string_like().find_first_of( const typename T::value_type*> {}; // Returns true iff the literal encoding is UTF-8. -constexpr auto is_utf8_enabled() -> bool { - // Avoid an MSVC sign extension bug: https://github.com/fmtlib/fmt/pull/2297. - using uchar = unsigned char; - return sizeof("\u00A7") == 3 && uchar("\u00A7"[0]) == 0xC2 && - uchar("\u00A7"[1]) == 0xA7; -} +constexpr auto is_utf8_enabled() -> bool { return "\u00A7"[1] == '\xA7'; } constexpr auto use_utf8() -> bool { return !FMT_MSC_VERSION || is_utf8_enabled(); }