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

Function decodeWindowBits

js/decode.ts:77–110  ·  view source on GitHub ↗
(s: State)

Source from the content-addressed store, hash-verified

75 }
76}
77function decodeWindowBits(s: State): number {
78 const largeWindowEnabled: number = s.isLargeWindow;
79 s.isLargeWindow = 0;
80 if (s.bitOffset >= 16) {
81 s.accumulator32 = (s.shortBuffer[s.halfOffset++] << 16) | (s.accumulator32 >>> 16);
82 s.bitOffset -= 16;
83 }
84 if (readFewBits(s, 1) === 0) {
85 return 16;
86 }
87 let n: number = readFewBits(s, 3);
88 if (n !== 0) {
89 return 17 + n;
90 }
91 n = readFewBits(s, 3);
92 if (n !== 0) {
93 if (n === 1) {
94 if (largeWindowEnabled === 0) {
95 return -1;
96 }
97 s.isLargeWindow = 1;
98 if (readFewBits(s, 1) === 1) {
99 return -1;
100 }
101 n = readFewBits(s, 6);
102 if (n < 10 || n > 30) {
103 return -1;
104 }
105 return n;
106 }
107 return 8 + n;
108 }
109 return 17;
110}
111function enableEagerOutput(s: State): number {
112 if (s.runningState !== 1) {
113 return makeError(s, -24);

Callers 1

decompressFunction · 0.70

Calls 1

readFewBitsFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…