EncodeBytesDescending encodes the []byte value using an escape-based encoding and then inverts (ones complement) the result so that it sorts in reverse order, from larger to smaller lexicographically.
(b []byte, data []byte)
| 696 | // so that it sorts in reverse order, from larger to smaller |
| 697 | // lexicographically. |
| 698 | func EncodeBytesDescending(b []byte, data []byte) []byte { |
| 699 | n := len(b) |
| 700 | b = EncodeBytesAscending(b, data) |
| 701 | b[n] = bytesDescMarker |
| 702 | onesComplement(b[n+1:]) |
| 703 | return b |
| 704 | } |
| 705 | |
| 706 | // EncodeBytesSize returns the size of the []byte value when encoded using |
| 707 | // EncodeBytes{Ascending,Descending}. The function accounts for the encoding |
no test coverage detected
searching dependent graphs…