refactor: simplify prefix skipping conditions

This commit is contained in:
재욱 2026-02-08 21:25:00 +09:00
parent b50eeab22a
commit ad90d9a01d

View File

@ -476,12 +476,11 @@ template <typename T, typename UC>
FASTFLOAT_CONSTEXPR20 from_chars_result_t<UC> FASTFLOAT_CONSTEXPR20 from_chars_result_t<UC>
from_chars_advanced(UC const *first, UC const *last, T &value, from_chars_advanced(UC const *first, UC const *last, T &value,
parse_options_t<UC> options) noexcept { parse_options_t<UC> options) noexcept {
if ((options.format_options & parse_options_t<UC>::skip_prefix) != 0) { if (((options.format_options & parse_options_t<UC>::skip_prefix) != 0) &&
if ((last - first) >= 2 && *first == UC('0')) { (last - first >= 2) && (*first == UC('0'))) {
if ((first[1] == UC('x') || first[1] == UC('X')) || const UC c_low = UC(first[1] | UC(0x20));
(first[1] == UC('b') || first[1] == UC('B'))) { if (c_low == UC('x') || c_low == UC('b')) {
first += 2; first += 2;
}
} }
} }
return from_chars_advanced_caller< return from_chars_advanced_caller<