MCPcopy Create free account
hub / github.com/apache/fory / WriteVarint32

Method WriteVarint32

go/fory/buffer.go:1273–1276  ·  view source on GitHub ↗

WriteVarint32 writes a signed int32 using zigzag encoding (compatible with Java's writeVarint32).

(value int32)

Source from the content-addressed store, hash-verified

1271
1272// WriteVarint32 writes a signed int32 using zigzag encoding (compatible with Java's writeVarint32).
1273func (b *ByteBuffer) WriteVarint32(value int32) int8 {
1274 u := uint32((value << 1) ^ (value >> 31))
1275 return b.WriteVarUint32(u)
1276}
1277
1278// ReadVarint32 reads a signed int32 using zigzag decoding (compatible with Java's readVarint32).
1279func (b *ByteBuffer) ReadVarint32(err *Error) int32 {

Callers 15

TestDecimalOOMFunction · 0.95
testBufferVarFunction · 0.95
WriteDataMethod · 0.45
WriteDataMethod · 0.45
checkVarintFunction · 0.45
checkVarintWriteFunction · 0.45
writeRemainingFieldMethod · 0.45
writeOptionFastFunction · 0.45
SerializeFunction · 0.45

Calls 2

WriteVarUint32Method · 0.95
uint32Function · 0.50

Tested by 6

TestDecimalOOMFunction · 0.76
checkVarintFunction · 0.36
checkVarintWriteFunction · 0.36
WriteDataMethod · 0.36