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

Method WriteVarUint64

go/fory/buffer.go:932–948  ·  view source on GitHub ↗

WriteVarUint64 writes to unsigned varint (up to 9 bytes)

(value uint64)

Source from the content-addressed store, hash-verified

930
931// WriteVarUint64 writes to unsigned varint (up to 9 bytes)
932func (b *ByteBuffer) WriteVarUint64(value uint64) {
933 b.grow(9)
934 offset := b.writerIndex
935 data := b.data[offset : offset+9]
936
937 for i := 0; i < 8; i++ {
938 if value < 0x80 {
939 data[i] = byte(value)
940 b.writerIndex += i + 1
941 return
942 }
943 data[i] = byte(value&0x7F) | 0x80
944 value >>= 7
945 }
946 data[8] = byte(value)
947 b.writerIndex += 9
948}
949
950// WriteVaruint36Small writes a varint optimized for small values (up to 36 bits)
951// Used for string headers: (length << 2) | encoding

Callers 15

WriteVarint64Method · 0.95
TestDecimalOOMFunction · 0.95
testBufferVarFunction · 0.95
WriteDataMethod · 0.80
WriteDataMethod · 0.80
WriteDataMethod · 0.80

Calls 1

growMethod · 0.95