decodeUnsigned static method

int decodeUnsigned(
  1. List<int> bytes, {
  2. int n = 64,
})

Decodes a LEB128 bytes of a signed integer.

  • n (optional) argument specifies the number of bits in the integer.

Implementation

static int decodeUnsigned(List<int> bytes, {int n = 64}) {
  var result = 0;
  var shift = 0;
  var i = 0;

  while (true) {
    var byte = bytes[i++] & 0xFF;
    result |= _platform.shiftLeftInt((byte & 0x7F), shift);
    if ((byte & 0x80) == 0) break;
    shift += 7;
  }

  return result;
}