internal bool _tr_tally (int dist, // distance of matched string
int lc // match length-MIN_MATCH or unmatched char (if dist==0)
){
pending_buf[d_buf+last_lit*2] = (byte)(dist>>8);
pending_buf[d_buf+last_lit*2+1] = (byte)dist;
pending_buf[l_buf+last_lit] = (byte)lc; last_lit++;
if (dist == 0) {
// lc is the unmatched char
dyn_ltree[lc*2]++;
}
else {
matches++;
// Here, lc is the match length - MIN_MATCH
dist--; // dist = match distance - 1
dyn_ltree[(Tree._length_code[lc]+LITERALS+1)*2]++;
dyn_dtree[Tree.d_code(dist)*2]++;
}
if ((last_lit & 0x1fff) == 0 && level > 2) {
// Compute an upper bound for the compressed length
int out_length = last_lit*8;
int in_length = strstart - block_start;
int dcode;
for (dcode = 0; dcode < D_CODES; dcode++) {
out_length += (int)((int)dyn_dtree[dcode*2] *
(5L+Tree.extra_dbits[dcode]));
}
out_length >>= 3;
if ((matches < (last_lit/2)) && out_length < in_length/2) return true;
}
return (last_lit == lit_bufsize-1);
// We avoid equality with lit_bufsize because of wraparound at 64K
// on 16 bit machines and because stored blocks are restricted to
// 64K-1 bytes.
}