code: private long computeShift( final BigInteger max, final int i )  {
      int biggestBit = 0;
  
      int rangeD = max.subtract(_base[i]).add(BigInteger.ONE).add(BigInteger.ONE).bitLength();
      biggestBit = _isInt[i] ? rangeD : (rangeD == 64 ? 64 : rangeD + 1);
  
      // TODO: feed back to R warnings()
      if (biggestBit < 8) Log.warn("biggest bit should be >= 8 otherwise need to dip into next column (TODO)");  
      assert biggestBit >= 1;
      _shift[i] = Math.max(8, biggestBit)-8;
      long MSBwidth = 1L << _shift[i];
  
      BigInteger msbWidth = BigInteger.valueOf(MSBwidth);
      if (_base[i].mod(msbWidth).compareTo(BigInteger.ZERO) != 0) {
        _base[i] =  _isInt[i]? msbWidth.multiply(_base[i].divide(msbWidth).add(_base[i].signum()<0?BigInteger.valueOf(-1L):BigInteger.ZERO))
                :msbWidth.multiply (_base[i].divide(msbWidth));; // dealing with unsigned integer here
        assert _base[i].mod(msbWidth).compareTo(BigInteger.ZERO) == 0;
      }
      return max.subtract(_base[i]).add(BigInteger.ONE).shiftRight(_shift[i]).intValue();
    }
docs: power of the shift.