From 91c6aa5e30ab344c3f3b6d07af44e17a88d2b1b6 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 18 Feb 2011 13:09:02 +0100 Subject: [PATCH] isl_basic_map_sort_constraints: change comparison routine 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 --- isl_map.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/isl_map.c b/isl_map.c index 48e3663f..5173369d 100644 --- a/isl_map.c +++ b/isl_map.c @@ -6739,7 +6739,15 @@ static int qsort_constraint_cmp(const void *p1, const void *p2) { 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); } -- 2.11.4.GIT