* Add distance code and length to literal and distance trees * @param distance Distance code * @param length Length * @returns Value indicating if internal buffer is full
(distance: number, length: number)
| 691 | * @returns Value indicating if internal buffer is full |
| 692 | */ |
| 693 | public tallyDist(distance: number, length: number): boolean { |
| 694 | this._dBuf[this._lastLit] = distance; |
| 695 | this._lBuf[this._lastLit++] = length - 3; |
| 696 | |
| 697 | const lc = DeflaterHuffman._lCode(length - 3); |
| 698 | this._literalTree.freqs[lc]++; |
| 699 | if (lc >= 265 && lc < 285) { |
| 700 | this._extraBits += Math.floor((lc - 261) / 4); |
| 701 | } |
| 702 | |
| 703 | const dc = DeflaterHuffman._dCode(distance - 1); |
| 704 | this._distTree.freqs[dc]++; |
| 705 | if (dc >= 4) { |
| 706 | this._extraBits += Math.floor(dc / 2) - 1; |
| 707 | } |
| 708 | return this.isFull(); |
| 709 | } |
| 710 | |
| 711 | /** |
| 712 | * Add literal to buffer |
no test coverage detected