Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/NodeDB-Lab/nodedb
/ zigzag_encode
Function
zigzag_encode
nodedb-codec/src/delta.rs:32–34 ·
view source on GitHub ↗
(v: i64)
Source
from the content-addressed store, hash-verified
30
/// representations: 0→0, -1→1, 1→2, -2→3, 2→4, ...
31
#[inline]
32
fn zigzag_encode(v: i64) -> u64 {
33
((v << 1) ^ (v >> 63)) as u64
34
}
35
36
/// ZigZag-decode an unsigned u64 back to signed i64.
37
#[inline]
Callers
1
encode
Function · 0.70
Calls
no outgoing calls
Tested by
no test coverage detected