Function frameWindowSize [src]
Returns the window size required to decompress a frame, or null if it
cannot be determined (which indicates a malformed frame header).
Prototype
pub fn frameWindowSize(header: ZstandardHeader) ?u64
Parameters
header: ZstandardHeader
Source
pub fn frameWindowSize(header: ZstandardHeader) ?u64 {
if (header.window_descriptor) |descriptor| {
const exponent = (descriptor & 0b11111000) >> 3;
const mantissa = descriptor & 0b00000111;
const window_log = 10 + exponent;
const window_base = @as(u64, 1) << @as(u6, @intCast(window_log));
const window_add = (window_base / 8) * mantissa;
return window_base + window_add;
} else return header.content_size;
}