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

Method UnsafePutVarInt32

go/fory/buffer.go:718–721  ·  view source on GitHub ↗

UnsafePutVarInt32 writes a zigzag-encoded varint32 at the given offset without advancing writerIndex. Caller must have called Reserve() to ensure capacity. Returns the number of bytes written (1-5).

(offset int, value int32)

Source from the content-addressed store, hash-verified

716// Caller must have called Reserve() to ensure capacity.
717// Returns the number of bytes written (1-5).
718func (b *ByteBuffer) UnsafePutVarInt32(offset int, value int32) int {
719 u := uint32((value << 1) ^ (value >> 31))
720 return b.UnsafePutVarUint32(offset, u)
721}
722
723// UnsafePutVarUint32 writes an unsigned VarUint32 at the given offset without advancing writerIndex.
724// Caller must have called Reserve(8) to ensure capacity (8 for bulk uint64 write).

Callers 1

WriteDataMethod · 0.80

Calls 2

UnsafePutVarUint32Method · 0.95
uint32Function · 0.50

Tested by

no test coverage detected