Extents are compared using memory indices. There are two orderings for extents and both orders are kept current at all times. The normal or display order is as follows:
Extent A is ``less than'' extent B,
that is, earlier in the display order,
if: A-start < B-start,
or if: A-start = B-start, and A-end > B-end
So if two extents begin at the same position, the larger of them is the
earlier one in the display order (EXTENT_LESS is true).
For the e-order, the same thing holds:
Extent A is ``less than'' extent B in e-order,
that is, later in the buffer,
if: A-end < B-end,
or if: A-end = B-end, and A-start > B-start
So if two extents end at the same position, the smaller of them is the
earlier one in the e-order (EXTENT_E_LESS is true).
The display order and the e-order are complementary orders: any theorem about the display order also applies to the e-order if you swap all occurrences of “display order” and “e-order”, “less than” and “greater than”, and “extent start” and “extent end”.