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 › LookupDistCode
LookupDistCode
token.LookupDistCode
const LookupDistCode = packed struct (u5 )
File
Code
const LookupDistCode = packed struct (u5 ) {
code : ShortDistCode ,
const base_table = table : {
var bases : [30 ]u15 = undefined ;
for (0 .., &bases ) |c , *b | {
b .* = ShortDistCode .fromInt (c ).base ();
}
break :table bases ;
};
pub fn fromVal (v : u15 ) LookupDistCode {
return .{ .code = .fromVal (v ) };
}
pub fn base (c : LookupDistCode ) u15 {
return base_table [c .toInt ()];
}
pub fn extraBits (c : LookupDistCode ) u4 {
return c .code .extraBits ();
}
pub fn toInt (c : LookupDistCode ) u5 {
return @bitCast (c );
}
pub fn fromInt (x : u5 ) LookupDistCode {
return @bitCast (x );
}
}