MCPcopy Create free account
hub / github.com/google/pprof / decodeVarint

Function decodeVarint

profile/proto.go:201–212  ·  view source on GitHub ↗
(data []byte)

Source from the content-addressed store, hash-verified

199}
200
201func decodeVarint(data []byte) (uint64, []byte, error) {
202 var u uint64
203 for i := 0; ; i++ {
204 if i >= 10 || i >= len(data) {
205 return 0, nil, errors.New("bad varint")
206 }
207 u |= uint64(data[i]&0x7F) << uint(7*i)
208 if data[i]&0x80 == 0 {
209 return u, data[i+1:], nil
210 }
211 }
212}
213
214func decodeField(b *buffer, data []byte) ([]byte, error) {
215 x, data, err := decodeVarint(data)

Callers 4

peekNumVarintsFunction · 0.85
decodeFieldFunction · 0.85
decodeInt64sFunction · 0.85
decodeUint64sFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…