| ... | @@ -12,17 +12,11 @@ pub const Check = enum(u4) { | ... | @@ -12,17 +12,11 @@ pub const Check = enum(u4) { |
| 12 | }; | 12 | }; |
| 13 | | 13 | |
| 14 | fn readStreamFlags(reader: anytype, check: *Check) !void { | 14 | fn readStreamFlags(reader: anytype, check: *Check) !void { |
| 15 | var bit_reader = std.io.bitReader(.little, reader); | 15 | const reserved1 = try reader.readByte(); |
| 16 | | 16 | if (reserved1 != 0) return error.CorruptInput; |
| 17 | const reserved1 = try bit_reader.readBitsNoEof(u8, 8); | 17 | const byte = try reader.readByte(); |
| 18 | if (reserved1 != 0) | 18 | if ((byte >> 4) != 0) return error.CorruptInput; |
| 19 | return error.CorruptInput; | 19 | check.* = @enumFromInt(@as(u4, @truncate(byte))); |
| 20 | | | |
| 21 | check.* = @as(Check, @enumFromInt(try bit_reader.readBitsNoEof(u4, 4))); | | |
| 22 | | | |
| 23 | const reserved2 = try bit_reader.readBitsNoEof(u4, 4); | | |
| 24 | if (reserved2 != 0) | | |
| 25 | return error.CorruptInput; | | |
| 26 | } | 20 | } |
| 27 | | 21 | |
| 28 | pub fn decompress(allocator: Allocator, reader: anytype) !Decompress(@TypeOf(reader)) { | 22 | pub fn decompress(allocator: Allocator, reader: anytype) !Decompress(@TypeOf(reader)) { |