From 56d423399d66aedbdee0971946fdc6fb48bc3dbb Mon Sep 17 00:00:00 2001 From: IRainman Date: Sat, 8 Nov 2025 18:14:39 +0300 Subject: [PATCH] * Improving in code generation -> speedup. * fix warning in 32 bit build. --- include/fast_float/ascii_number.h | 6 +++--- include/fast_float/bigint.h | 8 ++++---- include/fast_float/digit_comparison.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/fast_float/ascii_number.h b/include/fast_float/ascii_number.h index b92e853..f3190ea 100644 --- a/include/fast_float/ascii_number.h +++ b/include/fast_float/ascii_number.h @@ -122,7 +122,7 @@ uint64_t simd_read8_to_u64(UC const *) { } // credit @aqrit -fastfloat_really_inline FASTFLOAT_CONSTEXPR14 uint64_t +fastfloat_really_inline FASTFLOAT_CONSTEXPR14 uint32_t parse_eight_digits_unrolled(uint64_t val) noexcept { constexpr uint64_t mask = 0x000000FF000000FF; constexpr uint64_t mul1 = 0x000F424000000064; // 100 + (1000000ULL << 32) @@ -130,12 +130,12 @@ parse_eight_digits_unrolled(uint64_t val) noexcept { val -= 0x3030303030303030; val = (val * 10) + (val >> 8); // val = (val * 2561) >> 8; val = (((val & mask) * mul1) + (((val >> 16) & mask) * mul2)) >> 32; - return val; + return uint32_t(val); } // Call this if chars are definitely 8 digits. template -fastfloat_really_inline FASTFLOAT_CONSTEXPR20 uint64_t +fastfloat_really_inline FASTFLOAT_CONSTEXPR20 uint32_t parse_eight_digits_unrolled(UC const *chars) noexcept { if (cpp20_and_in_constexpr() || !has_simd_opt()) { return parse_eight_digits_unrolled(read8_to_u64(chars)); // truncation okay diff --git a/include/fast_float/bigint.h b/include/fast_float/bigint.h index dc4db71..09d52b3 100644 --- a/include/fast_float/bigint.h +++ b/include/fast_float/bigint.h @@ -604,11 +604,11 @@ struct bigint : pow5_tables<> { exp -= large_step; } #ifdef FASTFLOAT_64BIT_LIMB - limb_t const small_step = 27; - limb const max_native = 7450580596923828125UL; + limb_t constexpr small_step = 27; + limb constexpr max_native = 7450580596923828125UL; #else - limb_t const small_step = 13; - limb const max_native = 1220703125U; + limb_t constexpr small_step = 13; + limb constexpr max_native = 1220703125U; #endif while (exp >= small_step) { FASTFLOAT_TRY(small_mul(vec, max_native)); diff --git a/include/fast_float/digit_comparison.h b/include/fast_float/digit_comparison.h index f7b8878..2ccda2a 100644 --- a/include/fast_float/digit_comparison.h +++ b/include/fast_float/digit_comparison.h @@ -260,7 +260,7 @@ round_up_bigint(bigint &big, am_digits &count) noexcept { // parse the significant digits into a big integer template -inline FASTFLOAT_CONSTEXPR20 am_digits +fastfloat_really_inline FASTFLOAT_CONSTEXPR20 am_digits parse_mantissa(bigint &result, const parsed_number_string_t &num) noexcept { // try to minimize the number of big integer and scalar multiplication. // therefore, try to parse 8 digits at a time, and multiply by the largest