mirror of
https://github.com/0x5eal/rbxts-pako.git
synced 2025-04-04 10:50:59 +01:00
add initialization l_buf and d_buf
This commit is contained in:
parent
42237287cb
commit
7644f9f3db
2 changed files with 5 additions and 2 deletions
|
@ -999,6 +999,9 @@ function deflateInit2(strm, level, method, windowBits, memLevel, strategy) {
|
|||
s.pending_buf_size = s.lit_bufsize * 4;
|
||||
s.pending_buf = utils.arrayCreate(s.pending_buf_size);
|
||||
|
||||
s.d_buf = Math.floor(s.lit_bufsize / 2);
|
||||
s.l_buf = (1 + 2) * s.lit_bufsize;
|
||||
|
||||
s.level = level;
|
||||
s.strategy = strategy;
|
||||
s.method = method;
|
||||
|
|
|
@ -162,12 +162,12 @@ function send_bits(s, value, length) {
|
|||
var len = length, val;
|
||||
if (s.bi_valid > (Buf_size - len)) {
|
||||
val = value;
|
||||
s.bi_buf |= val << s.bi_valid;
|
||||
s.bi_buf |= (val << s.bi_valid) & 0xffff;
|
||||
put_short(s, s.bi_buf);
|
||||
s.bi_buf = val >> (Buf_size - s.bi_valid);
|
||||
s.bi_valid += len - Buf_size;
|
||||
} else {
|
||||
s.bi_buf |= value << s.bi_valid;
|
||||
s.bi_buf |= (value << s.bi_valid) & 0xffff;
|
||||
s.bi_valid += len;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue