In particular, before we would simply sort the constraints lexicographically.
Now, we first check for the last non-zero coefficients and only when those
positions are the same do we continue with the lexicographical order.
The new ordering is the same as that used to order divs in isl_polynomial.c
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
{
const struct constraint *c1 = (const struct constraint *)p1;
const struct constraint *c2 = (const struct constraint *)p2;
+ int l1, l2;
unsigned size = isl_min(c1->size, c2->size);
+
+ l1 = isl_seq_last_non_zero(c1->c, size);
+ l2 = isl_seq_last_non_zero(c2->c, size);
+
+ if (l1 != l2)
+ return l1 - l2;
+
return isl_seq_cmp(c1->c, c2->c, size);
}