zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 13e08ea6f0fe6caa4ab0a0e6795f6864c96b9336 (tree)
parent ee4f5b3f92988bb57849ea0e8d3d2651cda4b696
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Thu, 24 Jul 2025 23:45:32 -0700

std.compress.zstd: fix endianness issue

instead of manually bitcast, use the handy dandy takeStruct function.

Diffstat:
Mlib/std/compress/zstd/Decompress.zig | 3+--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/std/compress/zstd/Decompress.zig b/lib/std/compress/zstd/Decompress.zig @@ -151,8 +151,7 @@ fn readInFrame(d: *Decompress, w: *Writer, limit: Limit, state: *State.InFrame) const in = d.input; const window_len = d.window_len; - const header_bytes = try in.takeArray(3); - const block_header: Frame.Zstandard.Block.Header = @bitCast(header_bytes.*); + const block_header = try in.takeStruct(Frame.Zstandard.Block.Header, .little); const block_size = block_header.size; const frame_block_size_max = state.frame.block_size_max; if (frame_block_size_max < block_size) return error.BlockOversize;