pub const fn zig_zag_encode(value: i64) -> u64Expand description
ZigZag encodes a signed integer. This maps small negative numbers to small, unsigned positive numbers, which improves their density for LEB128 encoding.
ZigZag encoding works by moving the sign bit from the most-significant bit to the least-significant bit. For the signed k-bit integer n, the formula is
(n << 1) ^ (n >> (k - 1))
See the following for a description of ZigZag encoding: https://protobuf.dev/programming-guides/encoding/#signed-ints