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

Method readVaruint36SmallFast

go/fory/buffer.go:994–1025  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

992}
993
994func (b *ByteBuffer) readVaruint36SmallFast() uint64 {
995 // Single instruction load using unsafe pointer cast (little-endian only)
996 // On big-endian systems, use binary.LittleEndian which the compiler optimizes
997 var bulk uint64
998 if isLittleEndian {
999 bulk = *(*uint64)(unsafe.Pointer(&b.data[b.readerIndex]))
1000 } else {
1001 bulk = binary.LittleEndian.Uint64(b.data[b.readerIndex:])
1002 }
1003
1004 result := bulk & 0x7F
1005 readLen := 1
1006
1007 if (bulk & 0x80) != 0 {
1008 readLen = 2
1009 result |= (bulk >> 1) & 0x3F80
1010 if (bulk & 0x8000) != 0 {
1011 readLen = 3
1012 result |= (bulk >> 2) & 0x1FC000
1013 if (bulk & 0x800000) != 0 {
1014 readLen = 4
1015 result |= (bulk >> 3) & 0xFE00000
1016 if (bulk & 0x80000000) != 0 {
1017 readLen = 5
1018 result |= (bulk >> 4) & 0xFF0000000
1019 }
1020 }
1021 }
1022 }
1023 b.readerIndex += readLen
1024 return result
1025}
1026
1027func (b *ByteBuffer) readVaruint36SmallSlow(err *Error) uint64 {
1028 var result uint64

Callers 1

ReadVaruint36SmallMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected