1. A method for encoding data to be sorted based on one or more fields, the method comprising the computer-implemented steps of: in response to a request to sort data items based on values for one or more fields of the data items, in descending order relative to a particular field of the one or more fields, constructing an initial array of bytes, for each data item, that represents the values for the one or more fields of the data item, and for each initial array of bytes, replacing one or more bytes that represent the value for the particular field with one or more bytes that are complements of the one or more bytes that represent the value for the particular field; wherein the method is performed by one or more computing devices.