This commit is contained in:
HedgehogInTheCPP 2026-09-18 22:25:08 +03:00
parent c8894d3722
commit af9f2b8dc2
2 changed files with 12 additions and 11 deletions

View File

@ -527,8 +527,8 @@ parse_number_string(UC const *p, UC const *pend,
answer.negative = *p == UC('-'); answer.negative = *p == UC('-');
if (answer.negative || if (answer.negative ||
// C++17 20.19.3.(7.1) explicitly forbids '+' sign here // C++17 20.19.3.(7.1) explicitly forbids '+' sign here
chars_format_t(options.format & chars_format::allow_leading_plus) && (chars_format_t(options.format & chars_format::allow_leading_plus) &&
!json_fmt && *p == UC('+')) { !json_fmt && *p == UC('+'))) {
++p; ++p;
if (p == pend) { if (p == pend) {
return report_parse_error<UC>( return report_parse_error<UC>(
@ -650,20 +650,21 @@ 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 && (chars_format_t(options.format & chars_format::scientific) && if (p != pend &&
(UC('e') == *p || UC('E') == *p)) ((chars_format_t(options.format & chars_format::scientific) &&
(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::fortran_fmt) && || (chars_format_t(options.format & detail::fortran_fmt) &&
(UC('+') == *p || UC('-') == *p || UC('d') == *p || UC('D') == *p)) (UC('+') == *p || UC('-') == *p || UC('d') == *p || UC('D') == *p))
#endif #endif
) { )) {
auto const *location_of_e = p; auto const *location_of_e = p;
#ifdef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN #ifndef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN
++p;
#else
if (UC('e') == *p || UC('E') == *p || UC('d') == *p || UC('D') == *p) { if (UC('e') == *p || UC('E') == *p || UC('d') == *p || UC('D') == *p) {
++p; ++p;
} }
#else
++p;
#endif #endif
bool neg_exp = false; bool neg_exp = false;
if (p != pend) { if (p != pend) {

View File

@ -300,7 +300,7 @@ parse_mantissa(bigint &result, const parsed_number_string_t<UC> &num) noexcept {
#if defined(FASTFLOAT_64BIT_LIMB) && defined(FASTFLOAT_X86_SIMD) && \ #if defined(FASTFLOAT_64BIT_LIMB) && defined(FASTFLOAT_X86_SIMD) && \
FASTFLOAT_X86_SIMD >= 31 FASTFLOAT_X86_SIMD >= 31
if FASTFLOAT_CONSTEXPR17 (sizeof(UC) == 1) { if FASTFLOAT_CONSTEXPR17 (sizeof(UC) == 1) {
if (!is_constant_evaluated() std::distance(p, pend) >= 16 && if (!is_constant_evaluated() && std::distance(p, pend) >= 16 &&
step - counter >= 16 && max_digits - digits >= 16) { step - counter >= 16 && max_digits - digits >= 16) {
parse_sixteen_digits(p, value, counter, digits); parse_sixteen_digits(p, value, counter, digits);
} }