Removed orphaned 'FASTEST' #ifdefs emulation

This commit is contained in:
Vitaly Puzrin 2014-02-14 06:41:20 +04:00
parent 806e23d9ca
commit b13f5f1de8

View file

@ -5,8 +5,6 @@ var utils = require('./utils');
var trees = require('./trees'); var trees = require('./trees');
var adler32 = require('./adler32'); var adler32 = require('./adler32');
var FASTEST = true;
var Z_NULL = c.Z_NULL; var Z_NULL = c.Z_NULL;
var MAX_WBITS = 15; var MAX_WBITS = 15;
@ -50,7 +48,7 @@ function flush_pending(strm) {
if (len > strm.avail_out) { if (len > strm.avail_out) {
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); utils.arraySet(strm.next_out, s.pending_buf, s.pending_out, len, strm.next_out_index);
strm.next_out_index += len; strm.next_out_index += len;
@ -95,8 +93,8 @@ function putShortMSB(s, b) {
function read_buf(strm, buf, start, size) { function read_buf(strm, buf, start, size) {
var len = strm.avail_in; var len = strm.avail_in;
if (len > size) { len = size;} if (len > size) { len = size; }
if (len === 0) { return 0;} if (len === 0) { return 0; }
strm.avail_in -= len; strm.avail_in -= len;
@ -178,7 +176,6 @@ function fill_window(s) {
} while (--n); } while (--n);
n = wsize; n = wsize;
if (FASTEST) {
p = n; p = n;
do { do {
m = s.head[--p]; m = s.head[--p];
@ -187,7 +184,7 @@ function fill_window(s) {
* its value will never be used. * its value will never be used.
*/ */
} while (--n); } while (--n);
}
more += wsize; more += wsize;
} }
if (s.strm.avail_in === 0) { if (s.strm.avail_in === 0) {
@ -219,9 +216,7 @@ function fill_window(s) {
//#endif //#endif
while (s.insert) { while (s.insert) {
s.ins_h = update_hash(s, s.ins_h, s.window[str + MIN_MATCH - 1]); 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; s.head[s.ins_h] = str;
str++; str++;
s.insert--; s.insert--;
@ -294,7 +289,7 @@ function deflate_stored(s, flush) {
} }
/* Copy as much as possible from input to output: */ /* Copy as much as possible from input to output: */
for (; ;) { for (;;) {
/* Fill the window as much as possible: */ /* Fill the window as much as possible: */
if (s.lookahead <= 1) { if (s.lookahead <= 1) {
@ -421,14 +416,7 @@ var Config = function (good_length, max_lazy, nice_length, max_chain, func) {
var configuration_table; var configuration_table;
if (FASTEST) { configuration_table = [
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 */ /* good lazy nice chain */
new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */ 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, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */
@ -441,8 +429,7 @@ if (FASTEST) {
new Config(8, 32, 128, 256, deflate_slow), /* 7 */ new Config(8, 32, 128, 256, deflate_slow), /* 7 */
new Config(32, 128, 258, 1024, deflate_slow), /* 8 */ new Config(32, 128, 258, 1024, deflate_slow), /* 8 */
new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */ new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */
]; ];
}
/* =========================================================================== /* ===========================================================================
* Initialize the "longest match" routines for a new zlib stream * Initialize the "longest match" routines for a new zlib stream
@ -609,15 +596,9 @@ function deflateInit2(strm, level, method, windowBits, memLevel, strategy) {
} }
var wrap = 1; var wrap = 1;
if (FASTEST) {
if (level !== 0) {
level = 1;
}
} else {
if (level === c.Z_DEFAULT_COMPRESSION) { if (level === c.Z_DEFAULT_COMPRESSION) {
level = 6; level = 6;
} }
}
if (windowBits < 0) { /* suppress zlib wrapper */ if (windowBits < 0) { /* suppress zlib wrapper */
wrap = 0; wrap = 0;
@ -726,7 +707,7 @@ function deflate(strm, flush) {
level_flags = 3; level_flags = 3;
} }
header |= (level_flags << 6); header |= (level_flags << 6);
if (s.strstart !== 0) { header |= PRESET_DICT;} if (s.strstart !== 0) { header |= PRESET_DICT; }
header += 31 - (header % 31); header += 31 - (header % 31);
s.status = BUSY_STATE; s.status = BUSY_STATE;
@ -737,7 +718,7 @@ function deflate(strm, flush) {
putShortMSB(s, strm.adler >>> 16); putShortMSB(s, strm.adler >>> 16);
putShortMSB(s, strm.adler & 0xffff); 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 */ /* Flush as much pending output as possible */