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

Function DecodeNonsortingUvarint

pkg/util/encoding/encoding.go:1757–1767  ·  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

1755// DecodeNonsortingUvarint decodes a value encoded by EncodeNonsortingUvarint. It
1756// returns the length of the encoded varint and value.
1757func DecodeNonsortingUvarint(buf []byte) (remaining []byte, length int, value uint64, err error) {
1758 // TODO(dan): Handle overflow.
1759 for i, b := range buf {
1760 value += uint64(b & 0x7f)
1761 if b < 0x80 {
1762 return buf[i+1:], i + 1, value, nil
1763 }
1764 value <<= 7
1765 }
1766 return buf, 0, 0, nil
1767}
1768
1769// DecodeNonsortingStdlibUvarint decodes a value encoded with binary.PutUvarint. It
1770// 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…