EncodeZigZag32 encodes v into dest using the Protobuf zig/zag encoding for more efficient encoding of negative numbers, and returns the number of bytes written.
(dest []byte, v int32)
| 431 | // EncodeZigZag32 encodes v into dest using the Protobuf zig/zag encoding for more efficient encoding |
| 432 | // of negative numbers, and returns the number of bytes written. |
| 433 | func EncodeZigZag32(dest []byte, v int32) int { |
| 434 | zz := uint64((uint32(v) << 1) ^ uint32((v >> 31))) |
| 435 | return EncodeVarint(dest, zz) |
| 436 | } |
| 437 | |
| 438 | // EncodeZigZag64 encodes v into dest using the Protobuf zig/zag encoding for more efficient encoding |
| 439 | // of negative numbers, and returns the number of bytes written. |
no test coverage detected