MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / decodeSym

Function decodeSym

packages/plugins/apps/src/git-client/packfile.ts:147–161  ·  view source on GitHub ↗
(br: BitReader, h: Huff)

Source from the content-addressed store, hash-verified

145 return { counts, symbols };
146}
147function decodeSym(br: BitReader, h: Huff): number {
148 let code = 0,
149 first = 0,
150 index = 0;
151 for (let len = 1; len <= 15; len++) {
152 code |= br.bit();
153 const count = h.counts[len];
154 if (code - first < count) return h.symbols[index + (code - first)];
155 index += count;
156 first += count;
157 first <<= 1;
158 code <<= 1;
159 }
160 throw new PackParseError("bad huffman code");
161}
162const LEN_BASE = [
163 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131,
164 163, 195, 227, 258,

Callers 1

inflateRawFunction · 0.85

Calls 1

bitMethod · 0.80

Tested by

no test coverage detected