Next: , Previous: , Up: Comparisons involving poly_int   [Contents][Index]

10.3.3 Comparing potentially-unordered poly_ints

In cases where there is no definite link between two poly_ints, we can usually make a conservatively-correct assumption. For example, the conservative assumption for alias analysis is that two references might alias.

One way of checking whether [begin1, end1) might overlap [begin2, end2) using the poly_int comparisons is:

maybe_gt (end1, begin2) && maybe_gt (end2, begin1)

and another (equivalent) way is:

!(known_le (end1, begin2) || known_le (end2, begin1))

However, in this particular example, it is better to use the range helper functions instead. See Range checks on poly_ints.