From bfbe4c486996ac2a7876b11d82f10493adb97a69 Mon Sep 17 00:00:00 2001 From: HedgehogInTheCPP Date: Tue, 18 Aug 2026 23:43:56 +0300 Subject: [PATCH] FASTFLOAT_HAS_SIMD -> FASTFLOAT_USE_SIMD --- README.md | 3 +++ include/fast_float/ascii_number.h | 8 ++++---- include/fast_float/float_common.h | 6 +++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 0c1ab4a..296fabb 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,9 @@ Introduced new optional macros to minimize overhead when certain parsing feature * **`FASTFLOAT_X86_SIMD`** Automatically uses reworking SSE parsing algorithms to improve performance on x86 machines. + +* **`FASTFLOAT_USE_SIMD`** + Add possibility to completely disable manual algorithms realization and give compiler more freedom --- diff --git a/include/fast_float/ascii_number.h b/include/fast_float/ascii_number.h index f948928..acb654e 100644 --- a/include/fast_float/ascii_number.h +++ b/include/fast_float/ascii_number.h @@ -20,7 +20,7 @@ namespace fast_float { template fastfloat_really_inline constexpr bool has_simd_opt() noexcept { -#ifdef FASTFLOAT_HAS_SIMD +#ifdef FASTFLOAT_USE_SIMD return std::is_same::value; #else return false; @@ -79,7 +79,7 @@ read_chars_to_unsigned(UC const *chars) noexcept { return val; } -#if FASTFLOAT_HAS_SIMD +#if FASTFLOAT_USE_SIMD #if FASTFLOAT_X86_SIMD @@ -181,7 +181,7 @@ parse_four_digits_unrolled(uint32_t val) noexcept { return (((val & 0x00FF00FF) * 0x00640001) >> 16) & 0xFFFF; } -#if FASTFLOAT_HAS_SIMD +#if FASTFLOAT_USE_SIMD #if FASTFLOAT_X86_SIMD @@ -415,7 +415,7 @@ loop_parse_if_digits(UC const *&p, UC const *const pend, uint64_t &i) noexcept { fastfloat_really_inline FASTFLOAT_CONSTEXPR20 void loop_parse_if_digits(char const *&p, char const *const pend, uint64_t &i) noexcept { -#if FASTFLOAT_X86_SIMD >= 42 && FASTFLOAT_HAS_SIMD +#if FASTFLOAT_X86_SIMD >= 42 && FASTFLOAT_USE_SIMD if (!is_constant_evaluated()) { /* * SSE4.2 handles 16 bytes at once. diff --git a/include/fast_float/float_common.h b/include/fast_float/float_common.h index c2c2866..eb42b4c 100644 --- a/include/fast_float/float_common.h +++ b/include/fast_float/float_common.h @@ -187,7 +187,7 @@ using parse_options = parse_options_t; #endif #endif -#ifdef FASTFLOAT_HAS_SIMD // user defined +#ifdef FASTFLOAT_USE_SIMD // user defined #else #ifdef FASTFLOAT_X86_SIMD // user defined level static_assert(FASTFLOAT_X86_SIMD == 20 || FASTFLOAT_X86_SIMD == 42 || @@ -219,10 +219,10 @@ static_assert(FASTFLOAT_X86_SIMD == 20 || FASTFLOAT_X86_SIMD == 42 || #endif #if defined(FASTFLOAT_X86_SIMD) || defined(FASTFLOAT_ARM_NEON) -#define FASTFLOAT_HAS_SIMD 1 +#define FASTFLOAT_USE_SIMD 1 #endif -#if FASTFLOAT_HAS_SIMD +#if FASTFLOAT_USE_SIMD #if defined(__GNUC__) // disable -Wcast-align=strict (GCC only) #define FASTFLOAT_SIMD_DISABLE_WARNINGS \