ulebEncode function

List<int> ulebEncode(
  1. int num
)

Implementation

List<int> ulebEncode(int num) {
  final arr = <int>[];
  var len = 0;

  if (num == 0) {
    return [0];
  }

  while (num > 0) {
    arr.add(num & 0x7f);
    if ((num >>= 7) != 0) {
      arr[len] |= 0x80;
    }
    len += 1;
  }

  return arr;
}