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 › clenHlen Private Function clenHlen Doc Source Private Function std.compress.flate.Compress.clenHlen
fn clenHlen (freqs : [19 ]u16 ) u4 Params File compress/flate/Compress.zig: 739
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759 fn clenHlen (freqs : [19 ]u16 ) u4 {
// Note that the first four codes (16, 17, 18, and 0) are always present.
if (builtin .mode != .small and (std .simd .suggestVectorLength (u16 ) orelse 1 ) >= 8 ) {
const V = @Vector (16 , u16 );
const hlen_mul : V = comptime m : {
var hlen_mul : [16 ]u16 = undefined ;
for (token .codegen_order [3 ..], 0 ..) |i , hlen | {
hlen_mul [i ] = hlen ;
}
break :m hlen_mul ;
};
const encoded = freqs [0 ..16 ].* != @as (V , @splat (0 ));
return @intCast (@reduce (.Max , @intFromBool (encoded ) * hlen_mul ));
} else {
var max : u4 = 0 ;
for (token .codegen_order [4 ..], 1 ..) |i , len | {
max = if (freqs [i ] == 0 ) max else @intCast (len );
}
return max ;
}
}