serializeU32AsUleb128 method

void serializeU32AsUleb128(
  1. int val
)

Implementation

void serializeU32AsUleb128(int val) {
  checkNumberRange(
    BigInt.from(val),
    BigInt.zero,
    BigInt.from(MAX_U32_NUMBER));

  var value = val;
  var valueArray = <int>[];
  while (value >>> 7 != 0) {
    valueArray.add((value & 0x7f) | 0x80);
    value >>>= 7;
  }
  valueArray.add(value);
  serialize(Uint8List.fromList(valueArray));
}