mirror of
https://github.com/0x5eal/rbxts-pako.git
synced 2025-04-11 06:10:57 +01:00
Removed float ops & added comments
This commit is contained in:
parent
abcb20fdf2
commit
822310eb43
2 changed files with 5 additions and 4 deletions
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue