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

Method UnsafeReadVarint32

go/fory/buffer.go:1290–1297  ·  view source on GitHub ↗

UnsafeReadVarint32 reads a varint32 without bounds checking. Caller must ensure remaining() >= 5 before calling.

(err *Error)

Source from the content-addressed store, hash-verified

1288// UnsafeReadVarint32 reads a varint32 without bounds checking.
1289// Caller must ensure remaining() >= 5 before calling.
1290func (b *ByteBuffer) UnsafeReadVarint32(err *Error) int32 {
1291 u := b.readVarUint32Fast(err)
1292 v := int32(u >> 1)
1293 if u&1 != 0 {
1294 v = ^v
1295 }
1296 return v
1297}
1298
1299// UnsafeReadVarint64 reads a varint64 without bounds checking.
1300// Caller must ensure remaining() >= 10 before calling.

Callers 2

ReadDataMethod · 0.80

Calls 2

readVarUint32FastMethod · 0.95
int32Function · 0.50

Tested by

no test coverage detected