variableNatEncode static method

List<int> variableNatEncode(
  1. BigInt val
)

Implementation

static List<int> variableNatEncode(BigInt val) {
  BigInt num = val & maskBig32;
  List<int> output = [(num & maskBig8).toInt() & 0x7F];
  num ~/= BigInt.from(128);
  while (num > BigInt.zero) {
    output.add(((num & maskBig8).toInt() & 0x7F) | 0x80);
    num ~/= BigInt.from(128);
  }
  output = output.reversed.toList();
  return output;
}