MCPcopy
hub / github.com/google/brotli / decodeBlockTypeAndLength

Function decodeBlockTypeAndLength

js/decode.ts:545–567  ·  view source on GitHub ↗
(s: State, treeType: number, numBlockTypes: number)

Source from the content-addressed store, hash-verified

543 return numTrees;
544}
545function 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}
568function decodeLiteralBlockSwitch(s: State): void {
569 s.literalBlockLength = decodeBlockTypeAndLength(s, 0, s.numLiteralBlockTypes);
570 const literalBlockType: number = s.rings[5];

Callers 3

decodeLiteralBlockSwitchFunction · 0.70
decodeCommandBlockSwitchFunction · 0.70

Calls 2

readSymbolFunction · 0.70
readBlockLengthFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…