From 8e074f1549779a5c19dccedfb379c53cd01914d3 Mon Sep 17 00:00:00 2001 From: mlugg Date: Sun, 23 Feb 2025 13:00:14 +0000 Subject: [PATCH] std: remove dependencies on legacy coercion --- lib/std/compress/lzma/decode.zig | 34 ++++++++++----------- lib/std/compress/lzma/decode/rangecoder.zig | 6 ++-- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/std/compress/lzma/decode.zig b/lib/std/compress/lzma/decode.zig index ec0619ba57..ac45eb52b3 100644 --- a/lib/std/compress/lzma/decode.zig +++ b/lib/std/compress/lzma/decode.zig @@ -112,17 +112,17 @@ pub const DecoderState = struct { .lzma_props = lzma_props, .unpacked_size = unpacked_size, .literal_probs = try Vec2D(u16).init(allocator, 0x400, .{ @as(usize, 1) << (lzma_props.lc + lzma_props.lp), 0x300 }), - .pos_slot_decoder = .{.{}} ** 4, + .pos_slot_decoder = @splat(.{}), .align_decoder = .{}, - .pos_decoders = .{0x400} ** 115, - .is_match = .{0x400} ** 192, - .is_rep = .{0x400} ** 12, - .is_rep_g0 = .{0x400} ** 12, - .is_rep_g1 = .{0x400} ** 12, - .is_rep_g2 = .{0x400} ** 12, - .is_rep_0long = .{0x400} ** 192, + .pos_decoders = @splat(0x400), + .is_match = @splat(0x400), + .is_rep = @splat(0x400), + .is_rep_g0 = @splat(0x400), + .is_rep_g1 = @splat(0x400), + .is_rep_g2 = @splat(0x400), + .is_rep_0long = @splat(0x400), .state = 0, - .rep = .{0} ** 4, + .rep = @splat(0), .len_decoder = .{}, .rep_len_decoder = .{}, }; @@ -145,15 +145,15 @@ pub const DecoderState = struct { self.lzma_props = new_props; for (&self.pos_slot_decoder) |*t| t.reset(); self.align_decoder.reset(); - self.pos_decoders = .{0x400} ** 115; - self.is_match = .{0x400} ** 192; - self.is_rep = .{0x400} ** 12; - self.is_rep_g0 = .{0x400} ** 12; - self.is_rep_g1 = .{0x400} ** 12; - self.is_rep_g2 = .{0x400} ** 12; - self.is_rep_0long = .{0x400} ** 192; + self.pos_decoders = @splat(0x400); + self.is_match = @splat(0x400); + self.is_rep = @splat(0x400); + self.is_rep_g0 = @splat(0x400); + self.is_rep_g1 = @splat(0x400); + self.is_rep_g2 = @splat(0x400); + self.is_rep_0long = @splat(0x400); self.state = 0; - self.rep = .{0} ** 4; + self.rep = @splat(0); self.len_decoder.reset(); self.rep_len_decoder.reset(); } diff --git a/lib/std/compress/lzma/decode/rangecoder.zig b/lib/std/compress/lzma/decode/rangecoder.zig index 515420a7d4..01930884d7 100644 --- a/lib/std/compress/lzma/decode/rangecoder.zig +++ b/lib/std/compress/lzma/decode/rangecoder.zig @@ -120,7 +120,7 @@ pub const RangeDecoder = struct { pub fn BitTree(comptime num_bits: usize) type { return struct { - probs: [1 << num_bits]u16 = .{0x400} ** (1 << num_bits), + probs: [1 << num_bits]u16 = @splat(0x400), const Self = @This(); @@ -151,8 +151,8 @@ pub fn BitTree(comptime num_bits: usize) type { pub const LenDecoder = struct { choice: u16 = 0x400, choice2: u16 = 0x400, - low_coder: [16]BitTree(3) = .{.{}} ** 16, - mid_coder: [16]BitTree(3) = .{.{}} ** 16, + low_coder: [16]BitTree(3) = @splat(.{}), + mid_coder: [16]BitTree(3) = @splat(.{}), high_coder: BitTree(8) = .{}, pub fn decode(