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

Function AppendCountedUvarint

scode/counted.go:33–45  ·  view source on GitHub ↗
(dst []byte, u64 uint64)

Source from the content-addressed store, hash-verified

31}
32
33func AppendCountedUvarint(dst []byte, u64 uint64) []byte {
34 for u64 != 0 {
35 dst = append(dst, byte(u64))
36 u64 >>= 8
37 }
38 if dst == nil {
39 // Input was a zero. Since zero was "appended" but encoded
40 // as nothing, return an empty slice so we don't turn an
41 // append zero into an append int(null).
42 dst = []byte{}
43 }
44 return dst
45}
46
47func DecodeCountedVarint(b []byte) int64 {
48 u64 := DecodeCountedUvarint(b)

Callers 2

AppendUintFunction · 0.92
AppendCountedVarintFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected