MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / DecodeNonsortingUvarint

Function DecodeNonsortingUvarint

pkg/util/encoding/encoding.go:2513–2523  ·  view source on GitHub ↗

DecodeNonsortingUvarint decodes a value encoded by EncodeNonsortingUvarint. It returns the length of the encoded varint and value.

(buf []byte)

Source from the content-addressed store, hash-verified

2511// DecodeNonsortingUvarint decodes a value encoded by EncodeNonsortingUvarint. It
2512// returns the length of the encoded varint and value.
2513func DecodeNonsortingUvarint(buf []byte) (remaining []byte, length int, value uint64, err error) {
2514 // TODO(dan): Handle overflow.
2515 for i, b := range buf {
2516 value += uint64(b & 0x7f)
2517 if b < 0x80 {
2518 return buf[i+1:], i + 1, value, nil
2519 }
2520 value <<= 7
2521 }
2522 return buf, 0, 0, nil
2523}
2524
2525// DecodeNonsortingStdlibUvarint decodes a value encoded with binary.PutUvarint. It
2526// returns the length of the encoded varint and value.

Callers 4

DecodeValueTagFunction · 0.85
DecodeUntaggedBytesValueFunction · 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…