MCPcopy
hub / github.com/golang/protobuf / EncodeZigzag32

Method EncodeZigzag32

proto/buffer.go:146–148  ·  view source on GitHub ↗

EncodeZigzag32 appends a 32-bit zig-zag varint encoding to the buffer.

(v uint64)

Source from the content-addressed store, hash-verified

144
145// EncodeZigzag32 appends a 32-bit zig-zag varint encoding to the buffer.
146func (b *Buffer) EncodeZigzag32(v uint64) error {
147 return b.EncodeVarint(uint64((uint32(v) << 1) ^ uint32((int32(v) >> 31))))
148}
149
150// EncodeZigzag64 appends a 64-bit zig-zag varint encoding to the buffer.
151func (b *Buffer) EncodeZigzag64(v uint64) error {

Callers 1

TestNumericPrimitivesFunction · 0.80

Calls 1

EncodeVarintMethod · 0.95

Tested by 1

TestNumericPrimitivesFunction · 0.64