internal void compress_block(short[] ltree, short[] dtree){
int dist; // distance of matched string
int lc; // match length or unmatched char (if dist == 0)
int lx = 0; // running index in l_buf
int code; // the code to send
int extra; // number of extra bits to send
if (last_lit != 0){
do{
dist=((pending_buf[d_buf+lx*2]<<8)&0xff00)|
(pending_buf[d_buf+lx*2+1]&0xff);
lc=(pending_buf[l_buf+lx])&0xff; lx++;
if(dist == 0){
send_code(lc, ltree); // send a literal byte
}
else{
// Here, lc is the match length - MIN_MATCH
code = Tree._length_code[lc];
send_code(code+LITERALS+1, ltree); // send the length code
extra = Tree.extra_lbits[code];
if(extra != 0){
lc -= Tree.base_length[code];
send_bits(lc, extra); // send the extra length bits
}
dist--; // dist is now the match distance - 1
code = Tree.d_code(dist);
send_code(code, dtree); // send the distance code
extra = Tree.extra_dbits[code];
if (extra != 0) {
dist -= Tree.base_dist[code];
send_bits(dist, extra); // send the extra distance bits
}
} // literal or match pair ?
// Check that the overlay between pending_buf and d_buf+l_buf is ok:
}
while (lx < last_lit);
}
send_code(END_BLOCK, ltree);
last_eob_len = ltree[END_BLOCK*2+1];
}