MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / write

Method write

atomic-core/src/change/format_v3/graph_fields/wire.rs:60–64  ·  view source on GitHub ↗
(&mut self, out: &mut Vec<u8>, n: u64)

Source from the content-addressed store, hash-verified

58pub(super) struct Delta(pub u64);
59impl Delta {
60 pub fn write(&mut self, out: &mut Vec<u8>, n: u64) {
61 let d = n.wrapping_sub(self.0);
62 put(out, (d << 1) ^ ((d as i64 >> 63) as u64));
63 self.0 = n;
64 }
65 pub fn read(&mut self, input: &mut &[u8]) -> FormatResult<u64> {
66 let z = get(input)?;
67 self.0 = self.0.wrapping_add((z >> 1) ^ 0u64.wrapping_sub(z & 1));

Callers 1

nMethod · 0.45

Calls 1

putFunction · 0.70

Tested by

no test coverage detected