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 standard library.
std › compress › flate › Compress › BitWriter › write Public Function write Doc Source Public Function std.compress.flate.Compress.BitWriter.write
pub fn write (b : *BitWriter , bits : u56 , n : u6 ) Writer .Error !void Params File compress/flate/Compress.zig: 99
99
100
101
102
103
104
105
106
107
108
109
110
111 pub fn write (b : *BitWriter , bits : u56 , n : u6 ) Writer .Error !void {
assert (@as (u8 , b .buffered ) >> b .buffered_n == 0 );
assert (@as (u57 , bits ) >> n == 0 ); // n may be 56 so u57 is needed
const combined = @shlExact (@as (u64 , bits ), b .buffered_n ) | b .buffered ;
const combined_bits = @as (u6 , b .buffered_n ) + n ;
const out = try b .output .writableSliceGreedy (8 );
mem .writeInt (u64 , out [0 ..8 ], combined , .little );
b .output .advance (combined_bits / 8 );
b .buffered_n = @truncate (combined_bits );
b .buffered = @intCast (combined >> (combined_bits - b .buffered_n ));
}
Asserts
bitsis zero-extended