latchAndAppend method

State latchAndAppend(
  1. HighLevelEncoderMode mode,
  2. int value
)

Implementation

State latchAndAppend(HighLevelEncoderMode mode, int value) {
  //assert binaryShiftByteCount == 0;
  int bitCount = _bitCount;
  Token token = _token;
  if (mode != _mode) {
    final int latch = HighLevelEncoder.latchTable[_mode.index][mode.index];
    token = token.add(latch & 0xFFFF, latch >> 16);
    bitCount += latch >> 16;
  }
  final int latchModeBitCount = mode == HighLevelEncoderMode.digit ? 4 : 5;
  token = token.add(value, latchModeBitCount);
  return State(token, mode, 0, bitCount + latchModeBitCount);
}