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 › lzma › Decode › Params › readHeader Public Function readHeader Doc Source Public Function std.compress.lzma.Decode.Params.readHeader
pub fn readHeader (reader : *Reader , options : Options ) !Params Params File compress/lzma.zig: 567
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598 pub fn readHeader (reader : *Reader , options : Options ) !Params {
var props = try reader .takeByte ();
if (props >= 225 ) return error .CorruptInput ;
const lc : u4 = @intCast (props % 9 );
props /= 9 ;
const lp : u3 = @intCast (props % 5 );
props /= 5 ;
const pb : u3 = @intCast (props );
const dict_size_provided = try reader .takeInt (u32 , .little );
const dict_size = @max (0x1000 , dict_size_provided );
const unpacked_size = switch (options .unpacked_size ) {
.read_from_header => blk : {
const unpacked_size_provided = try reader .takeInt (u64 , .little );
const marker_mandatory = unpacked_size_provided == 0xFFFF_FFFF_FFFF_FFFF ;
break :blk if (marker_mandatory ) null else unpacked_size_provided ;
},
.read_header_but_use_provided => |x | blk : {
_ = try reader .takeInt (u64 , .little );
break :blk x ;
},
.use_provided => |x | x ,
};
return .{
.properties = .{ .lc = lc , .lp = lp , .pb = pb },
.dict_size = dict_size ,
.unpacked_size = unpacked_size ,
};
}