sint32
sint32 is a scalar type in Protocol Buffers used to represent signed 32-bit integers. It uses ZigZag encoding before varint serialization, mapping signed values to unsigned to optimize wire sizes. Specifically, ZigZag for 32-bit values uses the mapping (n << 1) ^ (n >> 31). After this transformation, the value is encoded as a varint with wire type 0. The on-wire encoding can use up to five bytes.
Value range is the same as a 32-bit signed integer: -2,147,483,648 to 2,147,483,647. sint32 is available in
Compared with int32, which uses a direct varint encoding of the signed value, sint32’s zigzag encoding tends
Examples of the zigzag mapping include: 0 -> 0, -1 -> 1, 1 -> 2, -2 -> 3, 2 -> 4.
In practice, sint32 is a common choice when designing Protobuf schemas for data with skew toward small