ripple/BRRippleSerialize.c
/**
 * Compare 2 Ripple fields
 *
 * @param field1  A ripple field
 * @param field2  A ripple field
 * @return <0  field1 goes before field2
 *          0  the fields are the same
 *         >0  field2 goes before field1
 */
Compare 2 Ripple fields
@param field1  A ripple field
@param field2  A ripple field
@return <0  field1 goes before field2
0  the fields are the same
>0  field2 goes before field1
Compare 2 Ripple fields @param field1 A ripple field @param field2 A ripple field @return <0 field1 goes before field2 0 the fields are the same > 0 field2 goes before field1
int compare_function(const void *field1, const void *field2) {
    BRRippleField *first = (BRRippleField *)field1;
    BRRippleField *second = (BRRippleField *)field2;
    int fieldid1 = first->typeCode << 16 | first->fieldCode;
    int fieldid2 = second->typeCode << 16 | second->fieldCode;
    return(fieldid1 - fieldid2);
}
int compare_function ( const void * field1 , const void * field2 ) { BRRippleField * first = ( BRRippleField * ) field1 ; BRRippleField * second = ( BRRippleField * ) field2 ; int fieldid1 = first -> typeCode << 16 | first -> fieldCode ; int fieldid2 = second -> typeCode << 16 | second -> fieldCode ; return ( fieldid1 - fieldid2 ) ; }
Compare 2 Ripple fields
 @param field1  A ripple field
 @param field2  A ripple field
 @return <0  field1 goes before field2
          0  the fields are the same
         >0  field2 goes before field1
Compare 2 Ripple fields @param field1 A ripple field @param field2 A ripple field @return <0 field1 goes before field2 0 the fields are the same > 0 field2 goes before field1
// The sort order if first by type and then by field - so // just combine the values into a single integer and sort.