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('-');
if (answer.negative ||
// C++17 20.19.3.(7.1) explicitly forbids '+' sign here
chars_format_t(options.format & chars_format::allow_leading_plus) &&
!json_fmt && *p == UC('+')) {
(chars_format_t(options.format & chars_format::allow_leading_plus) &&
!json_fmt && *p == UC('+'))) {
++p;
if (p == pend) {
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.
am_pow_t exp_number = 0; // explicit exponential part
if (p != pend && (chars_format_t(options.format & chars_format::scientific) &&
(UC('e') == *p || UC('E') == *p))
if (p != pend &&
((chars_format_t(options.format & chars_format::scientific) &&
(UC('e') == *p || UC('E') == *p))
#ifndef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN
|| (chars_format_t(options.format & detail::fortran_fmt) &&
(UC('+') == *p || UC('-') == *p || UC('d') == *p || UC('D') == *p))
|| (chars_format_t(options.format & detail::fortran_fmt) &&
(UC('+') == *p || UC('-') == *p || UC('d') == *p || UC('D') == *p))
#endif
) {
)) {
auto const *location_of_e = p;
#ifdef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN
++p;
#else
#ifndef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN
if (UC('e') == *p || UC('E') == *p || UC('d') == *p || UC('D') == *p) {
++p;
}
#else
++p;
#endif
bool neg_exp = false;
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) && \
FASTFLOAT_X86_SIMD >= 31
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) {
parse_sixteen_digits(p, value, counter, digits);
}