From 489703f99dfcb186479101aef624c578ef5a80cd Mon Sep 17 00:00:00 2001 From: IRainman Date: Sun, 28 Dec 2025 19:59:46 +0300 Subject: [PATCH] type usage fixes. --- include/fast_float/decimal_to_binary.h | 16 +++++++--------- include/fast_float/digit_comparison.h | 4 ++-- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/include/fast_float/decimal_to_binary.h b/include/fast_float/decimal_to_binary.h index dd022c9..81b28f2 100644 --- a/include/fast_float/decimal_to_binary.h +++ b/include/fast_float/decimal_to_binary.h @@ -19,7 +19,7 @@ namespace fast_float { // template fastfloat_really_inline FASTFLOAT_CONSTEXPR20 value128 -compute_product_approximation(int64_t q, uint64_t w) noexcept { +compute_product_approximation(am_pow_t q, am_mant_t w) noexcept { am_pow_t const index = 2 * am_pow_t(q - powers::smallest_power_of_five); // For small values of q, e.g., q in [0,27], the answer is always exact // because The line value128 firstproduct = full_multiplication(w, @@ -71,14 +71,13 @@ constexpr fastfloat_really_inline am_pow_t power(am_pow_t q) noexcept { // for significant digits already multiplied by 10 ** q. template fastfloat_really_inline FASTFLOAT_CONSTEXPR14 adjusted_mantissa -compute_error_scaled(int64_t q, uint64_t w, am_digits lz) noexcept { - auto const hilz = static_cast((w >> 63) ^ 1); +compute_error_scaled(am_pow_t q, am_mant_t w, am_digits lz) noexcept { + auto const hilz = static_cast((w >> 63) ^ 1); adjusted_mantissa answer; answer.mantissa = w << hilz; constexpr am_pow_t bias = binary::mantissa_explicit_bits() - binary::minimum_exponent(); - answer.power2 = am_pow_t(detail::power(am_pow_t(q)) + bias - hilz - lz - 62 + - invalid_am_bias); + answer.power2 = detail::power(q) + bias - hilz - lz - 62 + invalid_am_bias; return answer; } @@ -86,7 +85,7 @@ compute_error_scaled(int64_t q, uint64_t w, am_digits lz) noexcept { // the power2 in the exponent will be adjusted by invalid_am_bias. template fastfloat_really_inline FASTFLOAT_CONSTEXPR20 adjusted_mantissa -compute_error(int64_t q, uint64_t w) noexcept { +compute_error(am_pow_t q, am_mant_t w) noexcept { am_digits const lz = leading_zeroes(w); w <<= lz; value128 product = @@ -101,7 +100,7 @@ compute_error(int64_t q, uint64_t w) noexcept { // should recompute in such cases. template fastfloat_really_inline FASTFLOAT_CONSTEXPR20 adjusted_mantissa -compute_float(int64_t q, uint64_t w) noexcept { +compute_float(am_pow_t q, am_mant_t w) noexcept { adjusted_mantissa answer; if ((w == 0) || (q < binary::smallest_power_of_ten())) { answer.power2 = 0; @@ -144,8 +143,7 @@ compute_float(int64_t q, uint64_t w) noexcept { answer.mantissa = product.high >> shift; - answer.power2 = am_pow_t(detail::power(am_pow_t(q)) + upperbit - lz - - binary::minimum_exponent()); + answer.power2 = detail::power(q) + upperbit - lz - binary::minimum_exponent(); if (answer.power2 <= 0) { // we have a subnormal or very small value. // Here have that answer.power2 <= 0 so -answer.power2 >= 0 if (-answer.power2 + 1 >= diff --git a/include/fast_float/digit_comparison.h b/include/fast_float/digit_comparison.h index b49acea..d7a3c95 100644 --- a/include/fast_float/digit_comparison.h +++ b/include/fast_float/digit_comparison.h @@ -76,8 +76,8 @@ to_extended(T const value) noexcept { am.mantissa = bits & mantissa_mask; } else { // normal - am.power2 = am_pow_t((bits & exponent_mask) >> - binary_format::mantissa_explicit_bits()); + am.power2 = static_cast(bits & exponent_mask) >> + binary_format::mantissa_explicit_bits(); am.power2 -= bias; am.mantissa = (bits & mantissa_mask) | hidden_bit_mask; }