latchAndAppend method

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

Implementation

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