MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / write_varint

Function write_varint

nodedb-array/src/codec/coord_delta.rs:34–45  ·  view source on GitHub ↗
(out: &mut Vec<u8>, mut v: u64)

Source from the content-addressed store, hash-verified

32}
33
34fn write_varint(out: &mut Vec<u8>, mut v: u64) {
35 loop {
36 let b = (v & 0x7F) as u8;
37 v >>= 7;
38 if v == 0 {
39 out.push(b);
40 break;
41 } else {
42 out.push(b | 0x80);
43 }
44 }
45}
46
47/// Returns (value, bytes_consumed). Returns None on truncated input.
48fn read_varint(data: &[u8]) -> Option<(u64, usize)> {

Callers 1

encode_coord_axisFunction · 0.70

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected