Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions include/fast_float/ascii_number.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,21 @@ loop_parse_if_eight_digits(char const *&p, char const *const pend,
p)); // in rare cases, this will overflow, but that's ok
p += 8;
}
// Consume a remaining 4-7 digit run in a single SWAR step instead of
// byte-by-byte (reuses the existing 4-digit helpers). The parsed result is
// identical either way. Gated to clang: on gcc the extra 4-digit check
// regresses inputs whose remainder is shorter than 4 digits (it becomes pure
// overhead there); clang does not show that.
#if defined(__clang__)
if ((pend - p) >= 4) {
uint32_t const val4 = read4_to_u32(p);
if (is_made_of_four_digits_fast(val4)) {
i = i * 10000 +
parse_four_digits_unrolled(val4); // may overflow, that's ok
p += 4;
}
}
#endif
}

enum class parse_error {
Expand Down
Loading