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/ › token.zig › LookupLenCode
LookupLenCode
token.LookupLenCode
const LookupLenCode = packed struct (u5 )
File
Code
const LookupLenCode = packed struct (u5 ) {
code : ShortLenCode ,
const code_table = table : {
var codes : [256 ]ShortLenCode = undefined ;
for (0 .., &codes ) |v , *c | {
c .* = .fromVal (v );
}
break :table codes ;
};
const base_table = table : {
var bases : [29 ]u8 = undefined ;
for (0 .., &bases ) |c , *b | {
b .* = ShortLenCode .fromInt (c ).base ();
}
break :table bases ;
};
pub fn fromVal (v : u8 ) LookupLenCode {
return .{ .code = code_table [v ] };
}
pub fn base (c : LookupLenCode ) u8 {
return base_table [c .toInt ()];
}
pub fn extraBits (c : LookupLenCode ) u3 {
return c .code .extraBits ();
}
pub fn toInt (c : LookupLenCode ) u5 {
return @bitCast (c );
}
pub fn fromInt (x : u5 ) LookupLenCode {
return @bitCast (x );
}
}