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 › zstd › Decompress › Frame › Zstandard › Header › decode Public Function decode Doc Source Public Function std.compress.zstd.Decompress.Frame.Zstandard.Header.decode
pub fn decode (in : *Reader ) DecodeError !Header Params File compress/zstd/Decompress.zig: 453
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478 pub fn decode (in : *Reader ) DecodeError !Header {
const descriptor : Descriptor = @bitCast (try in .takeByte ());
if (descriptor .reserved ) return error .ReservedBitSet ;
const window_descriptor : ?u8 = if (descriptor .single_segment_flag ) null else try in .takeByte ();
const dictionary_id : ?u32 = if (descriptor .dictionary_id_flag > 0 ) d : {
// if flag is 3 then field_size = 4, else field_size = flag
const field_size = (@as (u4 , 1 ) << descriptor .dictionary_id_flag ) >> 1 ;
break :d try in .takeVarInt (u32 , .little , field_size );
} else null ;
const content_size : ?u64 = if (descriptor .single_segment_flag or descriptor .content_size_flag > 0 ) c : {
const field_size = @as (u4 , 1 ) << descriptor .content_size_flag ;
const content_size = try in .takeVarInt (u64 , .little , field_size );
break :c if (field_size == 2 ) content_size + 256 else content_size ;
} else null ;
return .{
.descriptor = descriptor ,
.window_descriptor = window_descriptor ,
.dictionary_id = dictionary_id ,
.content_size = content_size ,
};
}