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

Method readVarUint64Slow

go/fory/buffer.go:1228–1253  ·  view source on GitHub ↗

Slow path (read byte by byte)

(err *Error)

Source from the content-addressed store, hash-verified

1226
1227// Slow path (read byte by byte)
1228func (b *ByteBuffer) readVarUint64Slow(err *Error) uint64 {
1229 var result uint64
1230 var shift uint
1231 for i := 0; i < 8; i++ {
1232 if b.readerIndex >= len(b.data) {
1233 if !b.fill(1, err) {
1234 return 0
1235 }
1236 }
1237 byteVal := b.data[b.readerIndex]
1238 b.readerIndex++
1239 result |= (uint64(byteVal) & 0x7F) << shift
1240 if byteVal < 0x80 {
1241 return result
1242 }
1243 shift += 7
1244 }
1245 if b.readerIndex >= len(b.data) {
1246 if !b.fill(1, err) {
1247 return 0
1248 }
1249 }
1250 byteVal := b.data[b.readerIndex]
1251 b.readerIndex++
1252 return result | (uint64(byteVal) << 56)
1253}
1254
1255// Auxiliary function
1256func (b *ByteBuffer) remaining() int {

Callers 1

ReadVarUint64Method · 0.95

Calls 2

fillMethod · 0.95
uint64Function · 0.50

Tested by

no test coverage detected