mirror of
https://github.com/fastfloat/fast_float.git
synced 2026-02-09 11:16:45 +08:00
refactor: simplify prefix skipping conditions
This commit is contained in:
parent
b50eeab22a
commit
ad90d9a01d
@ -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<
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user