mirror of
https://github.com/0x5eal/rbxts-pako.git
synced 2025-04-10 22:00:58 +01:00
parent
024d11ee5f
commit
f1c987cc5f
1 changed files with 8 additions and 12 deletions
|
@ -70,13 +70,11 @@ const inflate_table = (type, lens, lens_index, codes, table, table_index, work,
|
||||||
let mask; /* mask for low root bits */
|
let mask; /* mask for low root bits */
|
||||||
let next; /* next available space in table */
|
let next; /* next available space in table */
|
||||||
let base = null; /* base value table to use */
|
let base = null; /* base value table to use */
|
||||||
let base_index = 0;
|
|
||||||
// let shoextra; /* extra bits table to use */
|
// let shoextra; /* extra bits table to use */
|
||||||
let end; /* use base and extra for symbol > end */
|
let match; /* use base and extra for symbol >= match */
|
||||||
const count = new Uint16Array(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */
|
const count = new Uint16Array(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */
|
||||||
const offs = new Uint16Array(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */
|
const offs = new Uint16Array(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */
|
||||||
let extra = null;
|
let extra = null;
|
||||||
let extra_index = 0;
|
|
||||||
|
|
||||||
let here_bits, here_op, here_val;
|
let here_bits, here_op, here_val;
|
||||||
|
|
||||||
|
@ -211,19 +209,17 @@ const inflate_table = (type, lens, lens_index, codes, table, table_index, work,
|
||||||
// to avoid deopts in old v8
|
// to avoid deopts in old v8
|
||||||
if (type === CODES) {
|
if (type === CODES) {
|
||||||
base = extra = work; /* dummy value--not used */
|
base = extra = work; /* dummy value--not used */
|
||||||
end = 19;
|
match = 20;
|
||||||
|
|
||||||
} else if (type === LENS) {
|
} else if (type === LENS) {
|
||||||
base = lbase;
|
base = lbase;
|
||||||
base_index -= 257;
|
|
||||||
extra = lext;
|
extra = lext;
|
||||||
extra_index -= 257;
|
match = 257;
|
||||||
end = 256;
|
|
||||||
|
|
||||||
} else { /* DISTS */
|
} else { /* DISTS */
|
||||||
base = dbase;
|
base = dbase;
|
||||||
extra = dext;
|
extra = dext;
|
||||||
end = -1;
|
match = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initialize opts for loop */
|
/* initialize opts for loop */
|
||||||
|
@ -247,13 +243,13 @@ const inflate_table = (type, lens, lens_index, codes, table, table_index, work,
|
||||||
for (;;) {
|
for (;;) {
|
||||||
/* create table entry */
|
/* create table entry */
|
||||||
here_bits = len - drop;
|
here_bits = len - drop;
|
||||||
if (work[sym] < end) {
|
if (work[sym] + 1 < match) {
|
||||||
here_op = 0;
|
here_op = 0;
|
||||||
here_val = work[sym];
|
here_val = work[sym];
|
||||||
}
|
}
|
||||||
else if (work[sym] > end) {
|
else if (work[sym] >= match) {
|
||||||
here_op = extra[extra_index + work[sym]];
|
here_op = extra[work[sym] - match];
|
||||||
here_val = base[base_index + work[sym]];
|
here_val = base[work[sym] - match];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
here_op = 32 + 64; /* end of block */
|
here_op = 32 + 64; /* end of block */
|
||||||
|
|
Loading…
Add table
Reference in a new issue