MCPcopy Create free account
hub / github.com/CoderLine/alphaTab / tallyDist

Method tallyDist

packages/alphatab/src/zip/DeflaterHuffman.ts:693–709  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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

Callers 1

_deflateSlowMethod · 0.80

Calls 4

isFullMethod · 0.95
_lCodeMethod · 0.80
floorMethod · 0.80
_dCodeMethod · 0.80

Tested by

no test coverage detected