mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
std.compress.xz: eliminate dependency on std.Io.bitReader
This commit is contained in:
parent
89cd42ee80
commit
bb29846732
@ -12,17 +12,11 @@ pub const Check = enum(u4) {
|
||||
};
|
||||
|
||||
fn readStreamFlags(reader: anytype, check: *Check) !void {
|
||||
var bit_reader = std.io.bitReader(.little, reader);
|
||||
|
||||
const reserved1 = try bit_reader.readBitsNoEof(u8, 8);
|
||||
if (reserved1 != 0)
|
||||
return error.CorruptInput;
|
||||
|
||||
check.* = @as(Check, @enumFromInt(try bit_reader.readBitsNoEof(u4, 4)));
|
||||
|
||||
const reserved2 = try bit_reader.readBitsNoEof(u4, 4);
|
||||
if (reserved2 != 0)
|
||||
return error.CorruptInput;
|
||||
const reserved1 = try reader.readByte();
|
||||
if (reserved1 != 0) return error.CorruptInput;
|
||||
const byte = try reader.readByte();
|
||||
if ((byte >> 4) != 0) return error.CorruptInput;
|
||||
check.* = @enumFromInt(@as(u4, @truncate(byte)));
|
||||
}
|
||||
|
||||
pub fn decompress(allocator: Allocator, reader: anytype) !Decompress(@TypeOf(reader)) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user