Function
encode_varint
(mut value: usize, out: &mut impl BufWriter)
Source from the content-addressed store, hash-verified
| 22 | |
| 23 | #[inline] |
| 24 | pub fn encode_varint(mut value: usize, out: &mut impl BufWriter) { |
| 25 | loop { |
| 26 | if value < 0x80 { |
| 27 | out.put_u8(value as u8); |
| 28 | break; |
| 29 | } else { |
| 30 | out.put_u8(((value & 0x7f) | 0x80) as u8); |
| 31 | value >>= 7; |
| 32 | } |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | #[inline] |
| 37 | pub fn decode_varint<'a>(reader: &mut impl BufReader<'a>) -> Result<usize, DecodeError> { |
Tested by
no test coverage detected
Used in the wild real call sites across dependent graphs
searching dependent graphs…