appendLengthInfo static method

void appendLengthInfo(
  1. int numLetters,
  2. Version version,
  3. Mode mode,
  4. BitArray bits,
)

Append length info. On success, store the result in "bits".

Implementation

static void appendLengthInfo(
    int numLetters, Version version, Mode mode, BitArray bits) {
  var numBits = mode.getCharacterCountBits(version);
  if (numLetters >= (1 << numBits)) {
    throw WriterException('$numLetters is bigger than ${(1 << numBits) - 1}');
  }
  bits.appendBits(numLetters, numBits);
}