EncodeInt appends the encoded value to slice b and returns the appended slice. EncodeInt guarantees that the encoded value is in ascending order for comparison.
(b []byte, v int64)
| 36 | // EncodeInt appends the encoded value to slice b and returns the appended slice. |
| 37 | // EncodeInt guarantees that the encoded value is in ascending order for comparison. |
| 38 | func EncodeInt(b []byte, v int64) []byte { |
| 39 | var data [8]byte |
| 40 | u := EncodeIntToCmpUint(v) |
| 41 | binary.BigEndian.PutUint64(data[:], u) |
| 42 | return append(b, data[:]...) |
| 43 | } |
| 44 | |
| 45 | // EncodeIntDesc appends the encoded value to slice b and returns the appended slice. |
| 46 | // EncodeIntDesc guarantees that the encoded value is in descending order for comparison. |