in avro/src/util.rs [121:143]
fn decode_variable<R: Read>(reader: &mut R) -> AvroResult<u64> {
let mut i = 0u64;
let mut buf = [0u8; 1];
let mut j = 0;
loop {
if j > 9 {
// if j * 7 > 64
return Err(Error::IntegerOverflow);
}
reader
.read_exact(&mut buf[..])
.map_err(Error::ReadVariableIntegerBytes)?;
i |= (u64::from(buf[0] & 0x7F)) << (j * 7);
if (buf[0] >> 7) == 0 {
break;
} else {
j += 1;
}
}
Ok(i)
}