isBetterThanOrEqualTo method

bool isBetterThanOrEqualTo(
  1. State other
)

Implementation

bool isBetterThanOrEqualTo(State other) {
  int newModeBitCount = _bitCount +
      (HighLevelEncoder.latchTable[_mode.index][other._mode.index] >> 16);
  if (_binaryShiftByteCount < other._binaryShiftByteCount) {
    // add additional B/S encoding cost of other, if any
    newModeBitCount += other._binaryShiftCost - _binaryShiftCost;
  } else if (_binaryShiftByteCount > other._binaryShiftByteCount &&
      other._binaryShiftByteCount > 0) {
    // maximum possible additional cost (we end up exceeding the 31 byte boundary and other state can stay beneath it)
    newModeBitCount += 10;
  }
  return newModeBitCount <= other._bitCount;
}