Function sigma_ser::zig_zag_encode::encode_i32[][src]

pub fn encode_i32(v: i32) -> u64
Expand description

Encode a 32-bit value with ZigZag. ZigZag encodes signed integers into values that can be efficiently encoded with VLQ. (Otherwise, negative values must be sign-extended to 64 bits to be varint encoded, thus always taking 10 bytes on the wire.) see https://developers.google.com/protocol-buffers/docs/encoding#types

Although result should be of u32 we need to use u64 due to the signed Int used for result in Scala version