readVarint64 method
Int64
readVarint64()
Implementation
Int64 readVarint64() {
int shift = 0;
Int64 result = Int64.ZERO;
if (trans_.getBytesRemainingInBuffer() >= 10) {
Int8List buf = trans_.getBuffer() ?? Int8List(0);
int pos = trans_.getBufferPosition();
int off = 0;
while (true) {
int b = buf[pos + off].toSigned(8);
result |= Int64(b & 0x7f) << shift;
if ((b & 0x80) != 0x80) {
break;
}
shift += 7;
off++;
}
trans_.consumeBuffer(off + 1);
} else {
while (true) {
int b = readByte().toSigned(8);
result |= Int64(b & 0x7f) << shift;
if ((b & 0x80) != 0x80) {
break;
}
shift += 7;
}
}
return result;
}