(s: State, treeType: number, numBlockTypes: number)
| 543 | return numTrees; |
| 544 | } |
| 545 | function decodeBlockTypeAndLength(s: State, treeType: number, numBlockTypes: number): number { |
| 546 | const ringBuffers: Int32Array = s.rings; |
| 547 | const offset: number = 4 + treeType * 2; |
| 548 | if (s.bitOffset >= 16) { |
| 549 | s.accumulator32 = (s.shortBuffer[s.halfOffset++] << 16) | (s.accumulator32 >>> 16); |
| 550 | s.bitOffset -= 16; |
| 551 | } |
| 552 | let blockType: number = readSymbol(s.blockTrees, 2 * treeType, s); |
| 553 | const result: number = readBlockLength(s.blockTrees, 2 * treeType + 1, s); |
| 554 | if (blockType === 1) { |
| 555 | blockType = ringBuffers[offset + 1] + 1; |
| 556 | } else if (blockType === 0) { |
| 557 | blockType = ringBuffers[offset]; |
| 558 | } else { |
| 559 | blockType -= 2; |
| 560 | } |
| 561 | if (blockType >= numBlockTypes) { |
| 562 | blockType -= numBlockTypes; |
| 563 | } |
| 564 | ringBuffers[offset] = ringBuffers[offset + 1]; |
| 565 | ringBuffers[offset + 1] = blockType; |
| 566 | return result; |
| 567 | } |
| 568 | function decodeLiteralBlockSwitch(s: State): void { |
| 569 | s.literalBlockLength = decodeBlockTypeAndLength(s, 0, s.numLiteralBlockTypes); |
| 570 | const literalBlockType: number = s.rings[5]; |
no test coverage detected
searching dependent graphs…