Zig 0.17.0-dev (Split by item)
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 library itself.
Zig › std/ › compress/ › flate/ › Compress.zig › outputBytes
outputBytes
Compress.outputBytes
fn outputBytes (c : *Compress , bytes : []const u8 ) Writer .Error !void
File
Code
fn outputBytes (c : *Compress , bytes : []const u8 ) Writer .Error !void {
var remaining = bytes ;
while (remaining .len != 0 ) {
if (c .buffered_tokens .n == block_tokens ) {
@branchHint (.unlikely );
try c .writeBlock (false );
}
const n = @min (remaining .len , block_tokens - c .buffered_tokens .n , math .maxInt (u15 ));
assert (n != 0 );
const header : TokenBufferEntryHeader = .{ .kind = .bytes , .data = n };
c .buffered_tokens .list [c .buffered_tokens .pos ..][0 ..2 ].* = @bitCast (header );
@memcpy (c .buffered_tokens .list [c .buffered_tokens .pos + 2 ..][0 ..n ], remaining [0 ..n ]);
c .buffered_tokens .pos += @as (u32 , 2 ) + n ;
c .buffered_tokens .n += n ;
for (remaining [0 ..n ]) |b | {
c .buffered_tokens .lit_freqs [b ] += 1 ;
}
remaining = remaining [n ..];
}
}