diff --git a/include/fast_float/digit_comparison.h b/include/fast_float/digit_comparison.h index ca5f103..2e8f2fd 100644 --- a/include/fast_float/digit_comparison.h +++ b/include/fast_float/digit_comparison.h @@ -345,18 +345,18 @@ parse_mantissa(bigint &result, const parsed_number_string_t &num) noexcept { } template -inline FASTFLOAT_CONSTEXPR20 adjusted_mantissa positive_digit_comp( - bigint &bigmant, am_pow_t const exponent) noexcept { +fastfloat_really_inline FASTFLOAT_CONSTEXPR20 adjusted_mantissa +positive_digit_comp( + bigint &bigmant, adjusted_mantissa& am, am_pow_t const exponent) noexcept { FASTFLOAT_ASSERT(bigmant.pow10(exponent)); - adjusted_mantissa answer; bool truncated; - answer.mantissa = bigmant.hi64(truncated); + am.mantissa = bigmant.hi64(truncated); constexpr am_pow_t bias = binary_format::mantissa_explicit_bits() - binary_format::minimum_exponent(); - answer.power2 = + am.power2 = static_cast(bigmant.bit_length() - 64 + bias); - round(answer, [truncated](adjusted_mantissa &a, am_pow_t shift) { + round(am, [truncated](adjusted_mantissa &a, am_pow_t shift) { round_nearest_tie_even( a, shift, [truncated](bool is_odd, bool is_halfway, bool is_above) -> bool { @@ -365,7 +365,7 @@ inline FASTFLOAT_CONSTEXPR20 adjusted_mantissa positive_digit_comp( }); }); - return answer; + return am; } // the scaling here is quite simple: we have, for the real digits `m * 10^e`, @@ -374,8 +374,9 @@ inline FASTFLOAT_CONSTEXPR20 adjusted_mantissa positive_digit_comp( // we then need to scale by `2^(f- e)`, and then the two significant digits // are of the same magnitude. template -inline FASTFLOAT_CONSTEXPR20 adjusted_mantissa negative_digit_comp( - bigint &bigmant, adjusted_mantissa am, am_pow_t const exponent) noexcept { +fastfloat_really_inline FASTFLOAT_CONSTEXPR20 adjusted_mantissa +negative_digit_comp( + bigint &bigmant, adjusted_mantissa& am, am_pow_t const exponent) noexcept { bigint &real_digits = bigmant; am_pow_t const &real_exp = exponent; @@ -411,7 +412,6 @@ inline FASTFLOAT_CONSTEXPR20 adjusted_mantissa negative_digit_comp( // compare digits, and use it to direct rounding int ord = real_digits.compare(theor_digits); - adjusted_mantissa answer = am; round(am, [ord](adjusted_mantissa &a, am_pow_t shift) { round_nearest_tie_even( a, shift, [ord](bool is_odd, bool _, bool __) -> bool { @@ -427,7 +427,7 @@ inline FASTFLOAT_CONSTEXPR20 adjusted_mantissa negative_digit_comp( }); }); - return answer; + return am; } // parse the significant digits as a big integer to unambiguously round @@ -445,7 +445,7 @@ inline FASTFLOAT_CONSTEXPR20 adjusted_mantissa negative_digit_comp( // of both, and use that to direct rounding. template inline FASTFLOAT_CONSTEXPR20 adjusted_mantissa digit_comp( - parsed_number_string_t const &num, adjusted_mantissa am) noexcept { + parsed_number_string_t const &num, adjusted_mantissa& am) noexcept { // remove the invalid exponent bias am.power2 -= invalid_am_bias; @@ -456,7 +456,7 @@ inline FASTFLOAT_CONSTEXPR20 adjusted_mantissa digit_comp( am_pow_t const exponent = static_cast(sci_exp + 1 - static_cast(digits)); if (exponent >= 0) { - return positive_digit_comp(bigmant, exponent); + return positive_digit_comp(bigmant, am, exponent); } else { return negative_digit_comp(bigmant, am, exponent); }