Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Private Function

tryParseDigits

Private Function
std.fmt.parse_float.parse.tryParseDigits
fn tryParseDigits(comptime T: type, stream: *FloatStream, x: *T, comptime base: u8) void

Parse digits until a non-digit character is found.

Params

File

fmt/parse_float/parse.zig:28
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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;
    }
}