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) {