Parse digits until a non-digit character is found.
fn tryParseDigits(comptime T: type, stream: *FloatStream, x: *T, comptime base: u8) void
fn tryParseDigits(comptime T: type, stream: *FloatStream, x: *T, comptime base: u8) void {
// Try to parse 8 digits at a time, using an optimized algorithm.
// This only supports decimal digits.
if (base == 10) {
while (stream.hasLen(8)) {
const v = stream.readU64Unchecked();
if (!isEightDigits(v)) {
break;
}
x.* = x.* *% 1_0000_0000 +% parse8Digits(v);
stream.advance(8);
}
}
while (stream.scanDigit(base)) |digit| {
x.* *%= base;
x.* +%= digit;
}
}