From ce06f10c2a9a5a7355e546e7460578522974c746 Mon Sep 17 00:00:00 2001 From: HedgehogInTheCPP Date: Fri, 21 Aug 2026 21:13:44 +0300 Subject: [PATCH] fix for UTF-16 emoji parsing. --- include/fast_float/ascii_number.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/fast_float/ascii_number.h b/include/fast_float/ascii_number.h index 69366fe..995fc47 100644 --- a/include/fast_float/ascii_number.h +++ b/include/fast_float/ascii_number.h @@ -31,7 +31,9 @@ fastfloat_really_inline constexpr bool has_simd_opt() noexcept { // able to optimize it well. template fastfloat_really_inline constexpr bool is_integer(UC c) noexcept { - return static_cast(c - UC('0')) <= 9; + const auto d = c - UC('0'); + // UC may be signed. + return d >= 0 && d <= 9; } #if FASTFLOAT_IS_BIG_ENDIAN