Skip to main content

zigzag_encode

Function zigzag_encode 

Source
pub fn zigzag_encode(value: i64) -> u64
Expand description

ZigZag encode a signed integer to unsigned (for efficient small negative number encoding)

ZigZag encoding maps signed integers to unsigned integers so that numbers with small absolute values have small encodings: 0 -> 0, -1 -> 1, 1 -> 2, -2 -> 3, 2 -> 4, -3 -> 5, …