From b121f533160ff6be21471f49ea4f15d0fa14bf40 Mon Sep 17 00:00:00 2001 From: IRainman Date: Tue, 8 Apr 2025 03:55:12 +0300 Subject: [PATCH] reduce register pressure. --- include/fast_float/bigint.h | 18 +++++++++--------- include/fast_float/decimal_to_binary.h | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/fast_float/bigint.h b/include/fast_float/bigint.h index e609f69..4e3e06c 100644 --- a/include/fast_float/bigint.h +++ b/include/fast_float/bigint.h @@ -37,10 +37,10 @@ constexpr size_t bigint_limbs = bigint_bits / limb_bits; // vector-like type that is allocated on the stack. the entire // buffer is pre-allocated, and only the length changes. -template struct stackvec { +template struct stackvec { limb data[size]; // we never need more than 150 limbs - uint16_t length{0}; + uint8_t length{0}; FASTFLOAT_CONSTEXPR20 stackvec() noexcept = default; stackvec(stackvec const &) = delete; @@ -72,14 +72,14 @@ template struct stackvec { // set the length, without bounds checking. FASTFLOAT_CONSTEXPR14 void set_len(size_t len) noexcept { - length = uint16_t(len); + length = uint8_t(len); } - constexpr size_t len() const noexcept { return length; } + constexpr uint8_t len() const noexcept { return length; } constexpr bool is_empty() const noexcept { return length == 0; } - constexpr size_t capacity() const noexcept { return size; } + constexpr uint8_t capacity() const noexcept { return size; } // append item to vector, without bounds checking FASTFLOAT_CONSTEXPR14 void push_unchecked(limb value) noexcept { @@ -375,7 +375,7 @@ FASTFLOAT_CONSTEXPR20 bool large_mul(stackvec &x, limb_span y) noexcept { } template struct pow5_tables { - static constexpr uint32_t large_step = 135; + static constexpr uint8_t large_step = 135; static constexpr uint64_t small_power_of_5[] = { 1UL, 5UL, @@ -419,7 +419,7 @@ template struct pow5_tables { #if FASTFLOAT_DETAIL_MUST_DEFINE_CONSTEXPR_VARIABLE -template constexpr uint32_t pow5_tables::large_step; +template constexpr uint8_t pow5_tables::large_step; template constexpr uint64_t pow5_tables::small_power_of_5[]; @@ -605,10 +605,10 @@ struct bigint : pow5_tables<> { exp -= large_step; } #ifdef FASTFLOAT_64BIT_LIMB - uint32_t small_step = 27; + uint8_t small_step = 27; limb max_native = 7450580596923828125UL; #else - uint32_t small_step = 13; + uint8_t small_step = 13; limb max_native = 1220703125U; #endif while (exp >= small_step) { diff --git a/include/fast_float/decimal_to_binary.h b/include/fast_float/decimal_to_binary.h index 94d0a00..cdff846 100644 --- a/include/fast_float/decimal_to_binary.h +++ b/include/fast_float/decimal_to_binary.h @@ -17,7 +17,7 @@ namespace fast_float { // most significant bits and the low part corresponding to the least significant // bits. // -template +template fastfloat_really_inline FASTFLOAT_CONSTEXPR20 value128 compute_product_approximation(int64_t q, uint64_t w) noexcept { int const index = 2 * int(q - powers::smallest_power_of_five);