Removed float ops & added comments

master
Vitaly Puzrin 2014-02-18 04:01:10 +04:00
rodzic abcb20fdf2
commit 822310eb43
2 zmienionych plików z 5 dodań i 4 usunięć

Wyświetl plik

@ -556,7 +556,7 @@ function deflate_fast(s, flush) {
/* Insert new strings in the hash table only if the match length
* is not too large. This saves time but degrades compression.
*/
if (s.match_length <= s.max_lazy_match && s.lookahead >= MIN_MATCH) {
if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) {
s.match_length--; /* string at strstart already in table */
do {
s.strstart++;
@ -1089,7 +1089,8 @@ function DeflateState() {
* smaller than this value. This mechanism is used only for compression
* levels >= 4.
*/
this.max_insert_length = 0;
// That's alias to max_lazy_match, don't use directly
//this.max_insert_length = 0;
/* Insert new strings in the hash table only if the match length is not
* greater than this length. This saves time but degrades compression.
* max_insert_length is used only for compression levels <= 3.

Wyświetl plik

@ -659,7 +659,7 @@ function build_tree(s, desc)
/* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,
* establish sub-heaps of increasing lengths:
*/
for (n = Math.floor(s.heap_len / 2); n >= 1; n--) { pqdownheap(s, tree, n); }
for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); }
/* Construct the Huffman tree by repeatedly combining the least two
* frequent nodes.
@ -1126,7 +1126,7 @@ function _tr_tally(s, dist, lc)
//Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ",
// s->last_lit, in_length, out_length,
// 100L - out_length*100L/in_length));
if (s.matches < s.last_lit/2 && out_length < in_length/2) {
if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) {
return true;
}
}