Skip to content

Commit 13e08ea

Browse files
committed
std.compress.zstd: fix endianness issue
instead of manually bitcast, use the handy dandy takeStruct function.
1 parent ee4f5b3 commit 13e08ea

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/std/compress/zstd/Decompress.zig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,7 @@ fn readInFrame(d: *Decompress, w: *Writer, limit: Limit, state: *State.InFrame)
151151
const in = d.input;
152152
const window_len = d.window_len;
153153

154-
const header_bytes = try in.takeArray(3);
155-
const block_header: Frame.Zstandard.Block.Header = @bitCast(header_bytes.*);
154+
const block_header = try in.takeStruct(Frame.Zstandard.Block.Header, .little);
156155
const block_size = block_header.size;
157156
const frame_block_size_max = state.frame.block_size_max;
158157
if (frame_block_size_max < block_size) return error.BlockOversize;

0 commit comments

Comments
 (0)