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

Method ReadTaggedUint64

go/fory/buffer.go:1137–1166  ·  view source on GitHub ↗

ReadTaggedUint64 reads uint64 using tagged encoding. If bit 0 is 0, return value >> 1. Otherwise, skip flag byte and read 8 bytes as uint64.

(err *Error)

Source from the content-addressed store, hash-verified

1135// If bit 0 is 0, return value >> 1.
1136// Otherwise, skip flag byte and read 8 bytes as uint64.
1137func (b *ByteBuffer) ReadTaggedUint64(err *Error) uint64 {
1138 if b.readerIndex+4 > len(b.data) {
1139 if !b.fill(4, err) {
1140 return 0
1141 }
1142 }
1143 var i uint32
1144 if isLittleEndian {
1145 i = *(*uint32)(unsafe.Pointer(&b.data[b.readerIndex]))
1146 } else {
1147 i = binary.LittleEndian.Uint32(b.data[b.readerIndex:])
1148 }
1149 if (i & 0b1) != 0b1 {
1150 b.readerIndex += 4
1151 return uint64(i >> 1)
1152 }
1153 if b.readerIndex+9 > len(b.data) {
1154 if !b.fill(9, err) {
1155 return 0
1156 }
1157 }
1158 var value uint64
1159 if isLittleEndian {
1160 value = *(*uint64)(unsafe.Pointer(&b.data[b.readerIndex+1]))
1161 } else {
1162 value = binary.LittleEndian.Uint64(b.data[b.readerIndex+1:])
1163 }
1164 b.readerIndex += 9
1165 return value
1166}
1167
1168// ReadVarUint64 reads unsigned varint
1169func (b *ByteBuffer) ReadVarUint64(err *Error) uint64 {

Callers 12

ReadDataMethod · 0.80
readNumericValueByTypeIDFunction · 0.80
readDirectIntegerScalarFunction · 0.80
ReadDataMethod · 0.80
readRemainingFieldMethod · 0.80
readOptionFastFunction · 0.80
readFieldsInOrderMethod · 0.80
skipValueFunction · 0.80
readArrayValuesMethod · 0.80
readUint64ListValuesFunction · 0.80

Calls 2

fillMethod · 0.95
uint64Function · 0.50

Tested by

no test coverage detected