From 677cfe842547d41051f05677968191256ec3b1e9 Mon Sep 17 00:00:00 2001 From: HedgehogInTheCPP Date: Fri, 21 Aug 2026 23:10:50 +0300 Subject: [PATCH] Improvements detection of features, part 12. --- include/fast_float/ascii_number.h | 2 +- include/fast_float/bigint.h | 4 +--- include/fast_float/constexpr_feature_detect.h | 2 +- include/fast_float/digit_comparison.h | 2 +- include/fast_float/float_common.h | 8 ++++---- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/include/fast_float/ascii_number.h b/include/fast_float/ascii_number.h index f72ffa1..a3de75d 100644 --- a/include/fast_float/ascii_number.h +++ b/include/fast_float/ascii_number.h @@ -19,7 +19,7 @@ namespace fast_float { template -fastfloat_really_inline constexpr bool has_simd_opt() noexcept { +fastfloat_really_inline FASTFLOAT_CONSTEVAL bool has_simd_opt() noexcept { #ifdef FASTFLOAT_USE_SIMD return std::is_same::value; #else diff --git a/include/fast_float/bigint.h b/include/fast_float/bigint.h index 297bad4..69c2db6 100644 --- a/include/fast_float/bigint.h +++ b/include/fast_float/bigint.h @@ -212,13 +212,11 @@ fastfloat_really_inline FASTFLOAT_CONSTEXPR20 limb scalar_add(limb x, limb y, bool &overflow) noexcept { limb z; // gcc and clang -#if defined(__has_builtin) -#if __has_builtin(__builtin_add_overflow) +#if FASTFLOAT_HAS_BUILTIN(__builtin_add_overflow) if (!is_constant_evaluated()) { overflow = __builtin_add_overflow(x, y, &z); return z; } -#endif #endif // generic, this still optimizes correctly on MSVC. diff --git a/include/fast_float/constexpr_feature_detect.h b/include/fast_float/constexpr_feature_detect.h index 269f1af..20a998e 100644 --- a/include/fast_float/constexpr_feature_detect.h +++ b/include/fast_float/constexpr_feature_detect.h @@ -79,7 +79,7 @@ #define FASTFLOAT_IS_CONSTEXPR 1 #define FASTFLOAT_HAS_IS_CONSTANT_EVALUATED 1 #else -#define FASTFLOAT_CONSTEVAL +#define FASTFLOAT_CONSTEVAL FASTFLOAT_CONSTEXPR14 #define FASTFLOAT_CONSTEXPR20 #define FASTFLOAT_IS_CONSTEXPR 0 #define FASTFLOAT_HAS_IS_CONSTANT_EVALUATED 0 diff --git a/include/fast_float/digit_comparison.h b/include/fast_float/digit_comparison.h index bac10e3..f9019b8 100644 --- a/include/fast_float/digit_comparison.h +++ b/include/fast_float/digit_comparison.h @@ -241,7 +241,7 @@ parse_eight_digits(UC const *&p, limb &value, am_digits &counter, } template -fastfloat_really_inline FASTFLOAT_CONSTEXPR20 void +fastfloat_really_inline FASTFLOAT_CONSTEXPR14 void parse_four_digits(UC const *&p, limb &value, am_digits &counter, am_digits &count) noexcept { value = value * 10000 + parse_4_digits(read_chars_to_unsigned(p)); diff --git a/include/fast_float/float_common.h b/include/fast_float/float_common.h index 8ee495f..a4b944b 100644 --- a/include/fast_float/float_common.h +++ b/include/fast_float/float_common.h @@ -294,7 +294,7 @@ namespace fast_float { using std::bit_cast; #else template -fastfloat_really_inline FASTFLOAT_CONSTEXPR20 To bit_cast(const From &from) { +fastfloat_really_inline FASTFLOAT_CONSTEXPR14 To bit_cast(const From &from) { // Implementation of std::bit_cast for pre-C++20. auto to = To(); // The cast suppresses a bogus -Wclass-memaccess on GCC. @@ -355,7 +355,7 @@ struct is_supported_char_type #ifndef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN template -inline FASTFLOAT_CONSTEXPR14 bool +inline FASTFLOAT_CONSTEXPR20 bool fastfloat_strncasecmp3(UC const *actual_mixedcase, UC const *expected_lowercase) { if (is_constant_evaluated()) { @@ -396,7 +396,7 @@ fastfloat_strncasecmp3(UC const *actual_mixedcase, } template -inline FASTFLOAT_CONSTEXPR14 bool +inline FASTFLOAT_CONSTEXPR20 bool fastfloat_strncasecmp5(UC const *actual_mixedcase, UC const *expected_lowercase) noexcept { if (is_constant_evaluated()) { @@ -447,7 +447,7 @@ fastfloat_strncasecmp5(UC const *actual_mixedcase, // Compares two ASCII strings in a case insensitive manner. template -inline FASTFLOAT_CONSTEXPR14 bool +inline FASTFLOAT_CONSTEXPR20 bool fastfloat_strncasecmp(UC const *actual_mixedcase, UC const *expected_lowercase, uint_fast8_t const length) noexcept { if (is_constant_evaluated()) {