decodeVarint32 static method
Implementation
static LayoutDecodeResult<int> decodeVarint32(
List<int> data,
int offset, {
bool sign = false,
}) {
int value = 0;
int shift = 0;
int index = offset;
while (true) {
final byte = data[index++];
value |= (byte & 0x7F) << shift;
if ((byte & 0x80) == 0) {
break;
}
shift += 7;
}
if (sign && value > BinaryOps.maxInt32) {
value = value - 0x100000000;
}
return LayoutDecodeResult(consumed: index - offset, value: value);
}