compilation fix

This commit is contained in:
IRainman 2025-05-06 22:53:10 +03:00
parent 6f789de5d2
commit 1ec5f0880c
2 changed files with 15 additions and 12 deletions

View File

@ -367,7 +367,8 @@ parse_number_string(UC const *p, UC const *pend,
UC const digit = UC(*p - UC('0')); UC const digit = UC(*p - UC('0'));
answer.mantissa = static_cast<fast_float::am_mant_t>( answer.mantissa = static_cast<fast_float::am_mant_t>(
answer.mantissa * 10 + answer.mantissa * 10 +
digit); // in rare cases, this will overflow, but that's ok static_cast<am_mant_t>(
digit)); // in rare cases, this will overflow, but that's ok
++p; ++p;
} }
answer.exponent = static_cast<am_pow_t>(before - p); answer.exponent = static_cast<am_pow_t>(before - p);
@ -391,16 +392,15 @@ parse_number_string(UC const *p, UC const *pend,
// Now we can parse the explicit exponential part. // Now we can parse the explicit exponential part.
am_pow_t exp_number = 0; // explicit exponential part am_pow_t exp_number = 0; // explicit exponential part
if ((p != pend) && if (((p != pend) &&
((chars_format_t(options.format & chars_format::scientific) && (((chars_format_t(options.format & chars_format::scientific) &&
(UC('e') == *p) || ((UC('e') == *p) || (UC('E') == *p))))
(UC('E') == *p)))
#ifndef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN #ifndef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN
|| (chars_format_t(options.format & detail::basic_fortran_fmt) && || (chars_format_t(options.format & detail::basic_fortran_fmt) &&
((UC('+') == *p) || (UC('-') == *p) || (UC('d') == *p) || ((UC('+') == *p) || (UC('-') == *p) || (UC('d') == *p) ||
(UC('D') == *p))) (UC('D') == *p)))
#endif #endif
) { ))) {
UC const *location_of_e = p; UC const *location_of_e = p;
#ifdef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN #ifdef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN
++p; ++p;
@ -483,7 +483,8 @@ parse_number_string(UC const *p, UC const *pend,
am_mant_t const minimal_nineteen_digit_integer{1000000000000000000}; am_mant_t const minimal_nineteen_digit_integer{1000000000000000000};
while ((answer.mantissa < minimal_nineteen_digit_integer) && while ((answer.mantissa < minimal_nineteen_digit_integer) &&
(p != int_end)) { (p != int_end)) {
answer.mantissa = answer.mantissa * 10 + UC(*p - UC('0')); answer.mantissa = static_cast<am_mant_t>(
answer.mantissa * 10 + static_cast<am_mant_t>(*p - UC('0')));
++p; ++p;
} }
if (answer.mantissa >= if (answer.mantissa >=
@ -494,7 +495,8 @@ parse_number_string(UC const *p, UC const *pend,
UC const *frac_end = p + answer.fraction.len(); UC const *frac_end = p + answer.fraction.len();
while ((answer.mantissa < minimal_nineteen_digit_integer) && while ((answer.mantissa < minimal_nineteen_digit_integer) &&
(p != frac_end)) { (p != frac_end)) {
answer.mantissa = answer.mantissa * 10 + UC(*p - UC('0')); answer.mantissa = static_cast<am_mant_t>(
answer.mantissa * 10 + static_cast<am_mant_t>(*p - UC('0')));
++p; ++p;
} }
answer.exponent = am_pow_t(answer.fraction.ptr - p) + exp_number; answer.exponent = am_pow_t(answer.fraction.ptr - p) + exp_number;

View File

@ -457,7 +457,8 @@ inline FASTFLOAT_CONSTEXPR20 adjusted_mantissa digit_comp(
am_digits const digits = parse_mantissa<T, UC>(bigmant, num); am_digits const digits = parse_mantissa<T, UC>(bigmant, num);
// can't underflow, since digits is at most max_digits. // can't underflow, since digits is at most max_digits.
am_pow_t const exponent = static_cast<am_pow_t>(sci_exp + 1 - digits); am_pow_t const exponent =
static_cast<am_pow_t>(sci_exp + 1 - static_cast<am_pow_t>(digits));
if (exponent >= 0) { if (exponent >= 0) {
return positive_digit_comp<T>(bigmant, am, exponent); return positive_digit_comp<T>(bigmant, am, exponent);
} else { } else {