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

writeHex

Private Function
std.http.BodyWriter.writeHex
fn writeHex(buf: []u8, x: usize) void

Writes an integer as base 16 to buf, right-aligned, assuming the buffer has already been filled with zeroes.

Params

  • buf: []u8
  • x: usize

File

http.zig:1026
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
    fn writeHex(buf: []u8, x: usize) void {
        assert(std.mem.allEqual(u8, buf, '0'));
        const base = 16;
        var index: usize = buf.len;
        var a = x;
        while (a > 0) {
            const digit = a % base;
            index -= 1;
            buf[index] = std.fmt.digitToChar(@intCast(digit), .lower);
            a /= base;
        }
    }