From bc3f331938da63a16c3573d43b0f36cf32ff53fc Mon Sep 17 00:00:00 2001 From: IRainman Date: Thu, 6 Mar 2025 23:02:50 +0300 Subject: [PATCH] # cleanup. --- include/fast_float/float_common.h | 1 - include/fast_float/parse_number.h | 20 +++++++------------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/include/fast_float/float_common.h b/include/fast_float/float_common.h index edcda12..daf770c 100644 --- a/include/fast_float/float_common.h +++ b/include/fast_float/float_common.h @@ -56,7 +56,6 @@ enum class chars_format : uint64_t { fortran = uint64_t(detail::basic_fortran_fmt) | general, allow_leading_plus = 1 << 7, skip_white_space = 1 << 8, - disallow_leading_sign = 1 << 9, #endif }; diff --git a/include/fast_float/parse_number.h b/include/fast_float/parse_number.h index e165d17..0863d00 100644 --- a/include/fast_float/parse_number.h +++ b/include/fast_float/parse_number.h @@ -28,19 +28,13 @@ from_chars_result_t answer.ptr = first; answer.ec = std::errc(); // be optimistic [[assume(first < last)]]; // so dereference without checks - - bool minusSign; - if (!uint64_t(fmt & chars_format::disallow_leading_sign)) { - // C++17 20.19.3.(7.1) explicitly forbids '+' sign here - minusSign = (*first == UC('-')); - // C++17 20.19.3.(7.1) explicitly forbids '+' sign here - if ((*first == UC('-')) || - (uint64_t(fmt & chars_format::allow_leading_plus) && - (*first == UC('+')))) { - ++first; - } - } else { - minusSign = false; + + bool const minusSign = (*first == UC('-')); + // C++17 20.19.3.(7.1) explicitly forbids '+' sign here + if ((*first == UC('-')) || + (uint64_t(fmt & chars_format::allow_leading_plus) && + (*first == UC('+')))) { + ++first; } if (last - first >= 3) {