EncodeBitArrayAscending encodes a bitarray.BitArray value, appends it to the supplied buffer, and returns the final buffer. The encoding is guaranteed to be ordered such that if t1.Compare(t2) < 0 (or = 0 or > 0) then bytes.Compare will order them the same way after encoding. The encoding uses vari
(b []byte, d bitarray.BitArray)
| 1608 | // In contrast, the chosen encoding using varints is endianness-agnostic |
| 1609 | // and enables fast decoding/skipping thanks ot the tag bytes. |
| 1610 | func EncodeBitArrayAscending(b []byte, d bitarray.BitArray) []byte { |
| 1611 | b = append(b, bitArrayMarker) |
| 1612 | words, lastBitsUsed := d.EncodingParts() |
| 1613 | for _, w := range words { |
| 1614 | b = EncodeUvarintAscending(b, w) |
| 1615 | } |
| 1616 | b = append(b, bitArrayDataTerminator) |
| 1617 | b = EncodeUvarintAscending(b, lastBitsUsed) |
| 1618 | return b |
| 1619 | } |
| 1620 | |
| 1621 | // EncodeBitArrayDescending is the descending version of EncodeBitArrayAscending. |
| 1622 | func EncodeBitArrayDescending(b []byte, d bitarray.BitArray) []byte { |
nothing calls this directly
no test coverage detected
searching dependent graphs…