getBits static method

int getBits(
  1. int nBits,
  2. List<int> c_lc,
  3. InputBuffer input
)

Implementation

static int getBits(int nBits, List<int> c_lc, InputBuffer input) {
  while (c_lc[1] < nBits) {
    c_lc[0] = ((c_lc[0] << 8) | input.readByte()) & MASK_64;
    c_lc[1] = (c_lc[1] + 8) & MASK_32;
  }

  c_lc[1] -= nBits;

  return (c_lc[0] >> c_lc[1]) & ((1 << nBits) - 1);
}