mirror of
https://github.com/0x5eal/rbxts-pako.git
synced 2025-04-04 10:50:59 +01:00
Removed orphaned 'FASTEST' #ifdefs emulation
This commit is contained in:
parent
806e23d9ca
commit
b13f5f1de8
1 changed files with 31 additions and 50 deletions
|
@ -5,8 +5,6 @@ var utils = require('./utils');
|
|||
var trees = require('./trees');
|
||||
var adler32 = require('./adler32');
|
||||
|
||||
var FASTEST = true;
|
||||
|
||||
var Z_NULL = c.Z_NULL;
|
||||
|
||||
var MAX_WBITS = 15;
|
||||
|
@ -50,7 +48,7 @@ function flush_pending(strm) {
|
|||
if (len > strm.avail_out) {
|
||||
len = strm.avail_out;
|
||||
}
|
||||
if (len === 0) { return;}
|
||||
if (len === 0) { return; }
|
||||
|
||||
utils.arraySet(strm.next_out, s.pending_buf, s.pending_out, len, strm.next_out_index);
|
||||
strm.next_out_index += len;
|
||||
|
@ -95,8 +93,8 @@ function putShortMSB(s, b) {
|
|||
function read_buf(strm, buf, start, size) {
|
||||
var len = strm.avail_in;
|
||||
|
||||
if (len > size) { len = size;}
|
||||
if (len === 0) { return 0;}
|
||||
if (len > size) { len = size; }
|
||||
if (len === 0) { return 0; }
|
||||
|
||||
strm.avail_in -= len;
|
||||
|
||||
|
@ -178,16 +176,15 @@ function fill_window(s) {
|
|||
} while (--n);
|
||||
|
||||
n = wsize;
|
||||
if (FASTEST) {
|
||||
p = n;
|
||||
do {
|
||||
m = s.head[--p];
|
||||
s.head[p] = m >= wsize ? m - wsize : 0;
|
||||
/* If n is not on any hash chain, prev[n] is garbage but
|
||||
* its value will never be used.
|
||||
*/
|
||||
} while (--n);
|
||||
}
|
||||
p = n;
|
||||
do {
|
||||
m = s.head[--p];
|
||||
s.head[p] = m >= wsize ? m - wsize : 0;
|
||||
/* If n is not on any hash chain, prev[n] is garbage but
|
||||
* its value will never be used.
|
||||
*/
|
||||
} while (--n);
|
||||
|
||||
more += wsize;
|
||||
}
|
||||
if (s.strm.avail_in === 0) {
|
||||
|
@ -219,9 +216,7 @@ function fill_window(s) {
|
|||
//#endif
|
||||
while (s.insert) {
|
||||
s.ins_h = update_hash(s, s.ins_h, s.window[str + MIN_MATCH - 1]);
|
||||
if (FASTEST) {
|
||||
s.prev[str & s.w_mask] = s.head[s.ins_h];
|
||||
}
|
||||
s.prev[str & s.w_mask] = s.head[s.ins_h];
|
||||
s.head[s.ins_h] = str;
|
||||
str++;
|
||||
s.insert--;
|
||||
|
@ -294,7 +289,7 @@ function deflate_stored(s, flush) {
|
|||
}
|
||||
|
||||
/* Copy as much as possible from input to output: */
|
||||
for (; ;) {
|
||||
for (;;) {
|
||||
/* Fill the window as much as possible: */
|
||||
if (s.lookahead <= 1) {
|
||||
|
||||
|
@ -421,28 +416,20 @@ var Config = function (good_length, max_lazy, nice_length, max_chain, func) {
|
|||
|
||||
var configuration_table;
|
||||
|
||||
if (FASTEST) {
|
||||
configuration_table = [
|
||||
/* good lazy nice chain */
|
||||
new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */
|
||||
new Config(4, 4, 8, 4, deflate_fast) /* 1 max speed, no lazy matches */
|
||||
];
|
||||
} else {
|
||||
configuration_table = [
|
||||
/* good lazy nice chain */
|
||||
new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */
|
||||
new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */
|
||||
new Config(4, 5, 16, 8, deflate_fast), /* 2 */
|
||||
new Config(4, 6, 32, 32, deflate_fast), /* 3 */
|
||||
configuration_table = [
|
||||
/* good lazy nice chain */
|
||||
new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */
|
||||
new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */
|
||||
new Config(4, 5, 16, 8, deflate_fast), /* 2 */
|
||||
new Config(4, 6, 32, 32, deflate_fast), /* 3 */
|
||||
|
||||
new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */
|
||||
new Config(8, 16, 32, 32, deflate_slow), /* 5 */
|
||||
new Config(8, 16, 128, 128, deflate_slow), /* 6 */
|
||||
new Config(8, 32, 128, 256, deflate_slow), /* 7 */
|
||||
new Config(32, 128, 258, 1024, deflate_slow), /* 8 */
|
||||
new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */
|
||||
];
|
||||
}
|
||||
new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */
|
||||
new Config(8, 16, 32, 32, deflate_slow), /* 5 */
|
||||
new Config(8, 16, 128, 128, deflate_slow), /* 6 */
|
||||
new Config(8, 32, 128, 256, deflate_slow), /* 7 */
|
||||
new Config(32, 128, 258, 1024, deflate_slow), /* 8 */
|
||||
new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */
|
||||
];
|
||||
|
||||
/* ===========================================================================
|
||||
* Initialize the "longest match" routines for a new zlib stream
|
||||
|
@ -609,14 +596,8 @@ function deflateInit2(strm, level, method, windowBits, memLevel, strategy) {
|
|||
}
|
||||
var wrap = 1;
|
||||
|
||||
if (FASTEST) {
|
||||
if (level !== 0) {
|
||||
level = 1;
|
||||
}
|
||||
} else {
|
||||
if (level === c.Z_DEFAULT_COMPRESSION) {
|
||||
level = 6;
|
||||
}
|
||||
if (level === c.Z_DEFAULT_COMPRESSION) {
|
||||
level = 6;
|
||||
}
|
||||
|
||||
if (windowBits < 0) { /* suppress zlib wrapper */
|
||||
|
@ -726,7 +707,7 @@ function deflate(strm, flush) {
|
|||
level_flags = 3;
|
||||
}
|
||||
header |= (level_flags << 6);
|
||||
if (s.strstart !== 0) { header |= PRESET_DICT;}
|
||||
if (s.strstart !== 0) { header |= PRESET_DICT; }
|
||||
header += 31 - (header % 31);
|
||||
|
||||
s.status = BUSY_STATE;
|
||||
|
@ -737,7 +718,7 @@ function deflate(strm, flush) {
|
|||
putShortMSB(s, strm.adler >>> 16);
|
||||
putShortMSB(s, strm.adler & 0xffff);
|
||||
}
|
||||
strm.adler = 1;//adler32(0L, Z_NULL, 0);
|
||||
strm.adler = 1; // adler32(0L, Z_NULL, 0);
|
||||
}
|
||||
|
||||
/* Flush as much pending output as possible */
|
||||
|
|
Loading…
Add table
Reference in a new issue