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

Method WriteVarUint32Small7

go/fory/buffer.go:1407–1415  ·  view source on GitHub ↗

WriteVarUint32Small7 writes a uint32 in variable-length small-7 format

(value uint32)

Source from the content-addressed store, hash-verified

1405
1406// WriteVarUint32Small7 writes a uint32 in variable-length small-7 format
1407func (b *ByteBuffer) WriteVarUint32Small7(value uint32) int {
1408 b.grow(8)
1409 if value>>7 == 0 {
1410 b.data[b.writerIndex] = byte(value)
1411 b.writerIndex++
1412 return 1
1413 }
1414 return b.continueWriteVarUint32Small7(value)
1415}
1416
1417func (b *ByteBuffer) continueWriteVarUint32Small7(value uint32) int {
1418 encoded := uint64(value & 0x7F)

Calls 2

growMethod · 0.95