mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +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 {
|
fn readStreamFlags(reader: anytype, check: *Check) !void {
|
||||||
var bit_reader = std.io.bitReader(.little, reader);
|
const reserved1 = try reader.readByte();
|
||||||
|
if (reserved1 != 0) return error.CorruptInput;
|
||||||
const reserved1 = try bit_reader.readBitsNoEof(u8, 8);
|
const byte = try reader.readByte();
|
||||||
if (reserved1 != 0)
|
if ((byte >> 4) != 0) return error.CorruptInput;
|
||||||
return error.CorruptInput;
|
check.* = @enumFromInt(@as(u4, @truncate(byte)));
|
||||||
|
|
||||||
check.* = @as(Check, @enumFromInt(try bit_reader.readBitsNoEof(u4, 4)));
|
|
||||||
|
|
||||||
const reserved2 = try bit_reader.readBitsNoEof(u4, 4);
|
|
||||||
if (reserved2 != 0)
|
|
||||||
return error.CorruptInput;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn decompress(allocator: Allocator, reader: anytype) !Decompress(@TypeOf(reader)) {
|
pub fn decompress(allocator: Allocator, reader: anytype) !Decompress(@TypeOf(reader)) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user