MCPcopy Create free account
hub / github.com/brimdata/super / DecodeCountedUvarint

Function DecodeCountedUvarint

scode/counted.go:12–21  ·  view source on GitHub ↗

These functions provide variable length encoding and decoding of signed and unsigned integers when the length of the buffer is known, e.g., when the encoding lies within the body of a BSUP counted-length value.

(b []byte)

Source from the content-addressed store, hash-verified

10// value.
11
12func DecodeCountedUvarint(b []byte) uint64 {
13 n := len(b)
14 u64 := uint64(0)
15 for n > 0 {
16 n--
17 u64 <<= 8
18 u64 |= uint64(b[n])
19 }
20 return u64
21}
22
23func EncodeCountedUvarint(dst []byte, u64 uint64) uint {
24 var n uint

Callers 2

DecodeUintFunction · 0.92
DecodeCountedVarintFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected