encodeCompressedWeight method

void encodeCompressedWeight(
  1. StringBuffer buf,
  2. int currentPos,
  3. int weightSize
)

Implementation

void encodeCompressedWeight(
  StringBuffer buf,
  int currentPos,
  int weightSize,
) {
  final originalWeightNumeric =
      generalDecoder.extractNumericValueFromBitArray(currentPos, weightSize);
  addWeightCode(buf, originalWeightNumeric);

  final weightNumeric = checkWeight(originalWeightNumeric);

  int currentDivisor = 100000;
  for (int i = 0; i < 5; ++i) {
    if (weightNumeric ~/ currentDivisor == 0) {
      buf.write('0');
    }
    currentDivisor = currentDivisor ~/ 10;
  }
  buf.write(weightNumeric);
}