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

outputMatch

Private Function
std.compress.flate.Compress.outputMatch
fn outputMatch(c: *Compress, dist: u15, len: u8) Writer.Error!void

Params

File

compress/flate/Compress.zig:227
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
fn outputMatch(c: *Compress, dist: u15, len: u8) Writer.Error!void {
    // This must come first. Instead of ensuring a full block is never left buffered,
    // draining it is defered to allow end of stream to be indicated.
    if (c.buffered_tokens.n == block_tokens) {
        @branchHint(.unlikely); // LLVM 21 optimizes this branch as the more likely without
        try c.writeBlock(false);
    }
    const header: TokenBufferEntryHeader = .{ .kind = .match, .data = dist };
    c.buffered_tokens.list[c.buffered_tokens.pos..][0..2].* = @bitCast(header);
    c.buffered_tokens.list[c.buffered_tokens.pos + 2] = len;
    c.buffered_tokens.pos += 3;
    c.buffered_tokens.n += 1;

    c.buffered_tokens.lit_freqs[@as(usize, 257) + token.LenCode.fromVal(len).toInt()] += 1;
    c.buffered_tokens.dist_freqs[token.DistCode.fromVal(dist).toInt()] += 1;
}