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)
| 1124 | // In contrast, the chosen encoding using varints is endianness-agnostic |
| 1125 | // and enables fast decoding/skipping thanks ot the tag bytes. |
| 1126 | func EncodeBitArrayAscending(b []byte, d bitarray.BitArray) []byte { |
| 1127 | b = append(b, bitArrayMarker) |
| 1128 | words, lastBitsUsed := d.EncodingParts() |
| 1129 | for _, w := range words { |
| 1130 | b = EncodeUvarintAscending(b, w) |
| 1131 | } |
| 1132 | b = append(b, bitArrayDataTerminator) |
| 1133 | b = EncodeUvarintAscending(b, lastBitsUsed) |
| 1134 | return b |
| 1135 | } |
| 1136 | |
| 1137 | // EncodeBitArrayDescending is the descending version of EncodeBitArrayAscending. |
| 1138 | func EncodeBitArrayDescending(b []byte, d bitarray.BitArray) []byte { |
nothing calls this directly
no test coverage detected
searching dependent graphs…