MCPcopy Create free account
hub / github.com/HtmlUnit/htmlunit / readSymbol

Method readSymbol

src/main/java/org/htmlunit/util/brotli/Decode.java:413–428  ·  view source on GitHub ↗

Decodes the next Huffman code from bit-stream.

(int[] tableGroup, int tableIdx, State s)

Source from the content-addressed store, hash-verified

411 * Decodes the next Huffman code from bit-stream.
412 */
413 private static int readSymbol(int[] tableGroup, int tableIdx, State s) {
414 int offset = tableGroup[tableIdx];
415 final int v = BitReader.peekBits(s);
416 offset += v & HUFFMAN_TABLE_MASK;
417 final int bits = tableGroup[offset] >> 16;
418 final int sym = tableGroup[offset] & 0xFFFF;
419 if (bits <= HUFFMAN_TABLE_BITS) {
420 s.bitOffset += bits;
421 return sym;
422 }
423 offset += sym;
424 final int mask = (1 << bits) - 1;
425 offset += Utils.shr32(v & mask, HUFFMAN_TABLE_BITS);
426 s.bitOffset += ((tableGroup[offset] >> 16) + HUFFMAN_TABLE_BITS);
427 return tableGroup[offset] & 0xFFFF;
428 }
429
430 private static int readBlockLength(int[] tableGroup, int tableIdx, State s) {
431 BitReader.fillBitWindow(s);

Callers 4

readBlockLengthMethod · 0.95
decodeContextMapMethod · 0.95
decompressMethod · 0.95

Calls 2

peekBitsMethod · 0.95
shr32Method · 0.95

Tested by

no test coverage detected