MCPcopy Index your code
hub / github.com/google/brotli / calculateDistanceAlphabetLimit

Method calculateDistanceAlphabetLimit

java/org/brotli/dec/Decode.java:183–191  ·  view source on GitHub ↗
(State s, int maxDistance, int npostfix, int ndirect)

Source from the content-addressed store, hash-verified

181 // TODO(eustas): add a correctness test for this function when
182 // large-window and dictionary are implemented.
183 private static int calculateDistanceAlphabetLimit(State s, int maxDistance, int npostfix, int ndirect) {
184 if (maxDistance < ndirect + (2 << npostfix)) {
185 return Utils.makeError(s, BROTLI_PANIC_MAX_DISTANCE_TOO_SMALL);
186 }
187 final int offset = ((maxDistance - ndirect) >> npostfix) + 4;
188 final int ndistbits = log2floor(offset) - 1;
189 final int group = ((ndistbits - 1) << 1) | ((offset >> ndistbits) & 1);
190 return ((group - 1) << npostfix) + (1 << npostfix) + ndirect + NUM_DISTANCE_SHORT_CODES;
191 }
192
193 private static void unpackCommandLookupTable(short[] cmdLookup) {
194 final int[] insertLengthOffsets = new int[24];

Callers 2

initStateMethod · 0.95

Calls 2

makeErrorMethod · 0.95
log2floorMethod · 0.95

Tested by

no test coverage detected