std: remove dependencies on legacy coercion

This commit is contained in:
mlugg 2025-02-23 13:00:14 +00:00
parent 84da520c44
commit 8e074f1549
No known key found for this signature in database
GPG Key ID: 3F5B7DCCBF4AF02E
2 changed files with 20 additions and 20 deletions

View File

@ -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();
}

View File

@ -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(