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

Function DecodeBitArrayDescending

pkg/util/encoding/encoding.go:1696–1726  ·  view source on GitHub ↗

DecodeBitArrayDescending is the descending version of DecodeBitArrayAscending.

(b []byte)

Source from the content-addressed store, hash-verified

1694
1695// DecodeBitArrayDescending is the descending version of DecodeBitArrayAscending.
1696func DecodeBitArrayDescending(b []byte) ([]byte, bitarray.BitArray, error) {
1697 if PeekType(b) != BitArrayDesc {
1698 return nil, bitarray.BitArray{}, errors.Errorf("did not find marker %x", b)
1699 }
1700 b = b[1:]
1701
1702 // First compute the length.
1703 numWords, _, err := getBitArrayWordsLen(b, bitArrayDataDescTerminator)
1704 if err != nil {
1705 return b, bitarray.BitArray{}, err
1706 }
1707 // Decode the words.
1708 words := make([]uint64, numWords)
1709 for i := range words {
1710 b, words[i], err = DecodeUvarintDescending(b)
1711 if err != nil {
1712 return b, bitarray.BitArray{}, err
1713 }
1714 }
1715 // Decode the final part.
1716 if len(b) == 0 || b[0] != bitArrayDataDescTerminator {
1717 return b, bitarray.BitArray{}, errBitArrayTerminatorMissing
1718 }
1719 b = b[1:]
1720 b, lastVal, err := DecodeUvarintDescending(b)
1721 if err != nil {
1722 return b, bitarray.BitArray{}, err
1723 }
1724 ba, err := bitarray.FromEncodingParts(words, lastVal)
1725 return b, ba, err
1726}
1727
1728// Type represents the type of a value encoded by
1729// Encode{Null,NotNull,Varint,Uvarint,Float,Bytes}.

Callers 1

prettyPrintFirstValueFunction · 0.85

Calls 5

FromEncodingPartsFunction · 0.92
PeekTypeFunction · 0.85
getBitArrayWordsLenFunction · 0.85
DecodeUvarintDescendingFunction · 0.85
ErrorfMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…