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

Function offset

atomic-core/examples/semantic_codec_lab/lengths.rs:44–51  ·  view source on GitHub ↗
(tag: u64, refs: &mut &[u8], previous: &mut u64, cursor: usize)

Source from the content-addressed store, hash-verified

42 }
43}
44fn offset(tag: u64, refs: &mut &[u8], previous: &mut u64, cursor: usize) -> Result<usize> {
45 if tag == 0 {
46 return Ok(cursor);
47 }
48 let z = control::get(refs)?;
49 *previous = previous.wrapping_add((z >> 1) ^ 0u64.wrapping_sub(z & 1));
50 Ok(usize::try_from(*previous)?)
51}
52fn pool<'a>(view: &'a View<'_>, content: &'a [u8], tag: u64) -> &'a [u8] {
53 if tag == 2 {
54 view.literals

Callers 2

splitFunction · 0.85
valueMethod · 0.85

Calls 1

getFunction · 0.70

Tested by

no test coverage detected