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

Method write

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

Source from the content-addressed store, hash-verified

115pub(super) struct Delta(pub u64);
116impl Delta {
117 pub fn write(&mut self, out: &mut Vec<u8>, n: u64) {
118 let d = n.wrapping_sub(self.0);
119 put(out, (d << 1) ^ ((d as i64 >> 63) as u64));
120 self.0 = n;
121 }
122 pub fn read(&mut self, input: &mut &[u8]) -> FormatResult<u64> {
123 let z = get(input)?;
124 self.0 = self.0.wrapping_add((z >> 1) ^ 0u64.wrapping_sub(z & 1));

Callers 15

mainFunction · 0.45
get_verified_changeMethod · 0.45
insertMethod · 0.45
removeMethod · 0.45
clearMethod · 0.45
idMethod · 0.45
bytesMethod · 0.45
lineMethod · 0.45
shellMethod · 0.45
retire_secret_keyMethod · 0.45
saveMethod · 0.45

Calls 1

putFunction · 0.70