encodeSigned static method
Encodes an int into a LEB128 signed integer.
Implementation
static Uint8List encodeSigned(int n) {
var more = true;
var parts = <int>[];
while (more) {
var byte = n & 0x7F;
n = _platform.shiftRightInt(n, 7);
if (n == 0 && (byte & 0x40) == 0) {
more = false;
} else if (n == -1 && (byte & 0x40) > 0) {
more = false;
} else {
byte |= 0x80;
}
parts.add(byte);
}
return Uint8List.fromList(parts);
}