Skip to content

Commit eb0e59e

Browse files
committed
Use Box for decoding tables
1 parent 275afc9 commit eb0e59e

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/decompress.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,12 @@ pub const EXCEPTIONAL_ENTRY: u32 = 0x4000;
6363
pub const SECONDARY_TABLE_ENTRY: u32 = 0x2000;
6464

6565
/// The Decompressor state for a compressed block.
66-
#[repr(align(64))]
6766
#[derive(Eq, PartialEq, Debug)]
6867
struct CompressedBlock {
69-
litlen_table: [u32; 4096],
68+
litlen_table: Box<[u32; 4096]>,
7069
secondary_table: Vec<u16>,
7170

72-
dist_table: [u32; 512],
71+
dist_table: Box<[u32; 512]>,
7372
dist_secondary_table: Vec<u16>,
7473

7574
eof_code: u16,
@@ -124,8 +123,8 @@ impl Decompressor {
124123
buffer: 0,
125124
nbits: 0,
126125
compression: CompressedBlock {
127-
litlen_table: [0; 4096],
128-
dist_table: [0; 512],
126+
litlen_table: Box::new([0; 4096]),
127+
dist_table: Box::new([0; 512]),
129128
secondary_table: Vec::new(),
130129
dist_secondary_table: Vec::new(),
131130
eof_code: 0,
@@ -411,7 +410,7 @@ impl Decompressor {
411410
&code_lengths[..hlit],
412411
&LITLEN_TABLE_ENTRIES,
413412
&mut codes[..hlit],
414-
&mut compression.litlen_table,
413+
&mut *compression.litlen_table,
415414
&mut compression.secondary_table,
416415
false,
417416
true,
@@ -433,7 +432,7 @@ impl Decompressor {
433432
lengths,
434433
&tables::DISTANCE_TABLE_ENTRIES,
435434
&mut dist_codes,
436-
&mut compression.dist_table,
435+
&mut *compression.dist_table,
437436
&mut compression.dist_secondary_table,
438437
true,
439438
false,

0 commit comments

Comments
 (0)