GNU Compiler Collection (GCC) Internals: Sorting poly_ints

Previous: Range checks on `poly_int`s, Up: Comparisons involving `poly_int` [Contents][Index]

#### 10.3.7 Sorting `poly_int`s

`poly_int` provides the following routine for sorting:

‘`compare_sizes_for_sort (a, b)`’

  Compare a and b in reverse lexicographical order (that is, compare the highest-indexed coefficients first). This can be useful when sorting data structures, since it has the effect of separating constant and non-constant values. If all values are nonnegative, the constant values come first.

  Note that the values do not necessarily end up in numerical order. For example, ‘`1 + 1x`’ would come after ‘`100`’ in the sort order, but may well be less than ‘`100`’ at run time.