From a9ac417a5062dc7e620fffae9b0143f3de98b697 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Mon, 16 Jul 2012 19:32:22 +0200 Subject: [PATCH] isl_pw_aff_zero_set: return a rational set if the input is marked rational Signed-off-by: Sven Verdoolaege --- isl_aff.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/isl_aff.c b/isl_aff.c index 3338a3a..6517d68 100644 --- a/isl_aff.c +++ b/isl_aff.c @@ -1388,8 +1388,10 @@ __isl_give isl_basic_set *isl_aff_neg_basic_set(__isl_take isl_aff *aff) /* Return a basic set containing those elements in the space * of aff where it is zero. + * If "rational" is set, then return a rational basic set. */ -__isl_give isl_basic_set *isl_aff_zero_basic_set(__isl_take isl_aff *aff) +static __isl_give isl_basic_set *aff_zero_basic_set(__isl_take isl_aff *aff, + int rational) { isl_constraint *ineq; isl_basic_set *bset; @@ -1397,10 +1399,20 @@ __isl_give isl_basic_set *isl_aff_zero_basic_set(__isl_take isl_aff *aff) ineq = isl_equality_from_aff(aff); bset = isl_basic_set_from_constraint(ineq); + if (rational) + bset = isl_basic_set_set_rational(bset); bset = isl_basic_set_simplify(bset); return bset; } +/* Return a basic set containing those elements in the space + * of aff where it is zero. + */ +__isl_give isl_basic_set *isl_aff_zero_basic_set(__isl_take isl_aff *aff) +{ + return aff_zero_basic_set(aff, 0); +} + /* Return a basic set containing those elements in the shared space * of aff1 and aff2 where aff1 is greater than or equal to aff2. */ @@ -1885,8 +1897,11 @@ static __isl_give isl_set *pw_aff_zero_set(__isl_take isl_pw_aff *pwaff, for (i = 0; i < pwaff->n; ++i) { isl_basic_set *bset; isl_set *set_i, *zero; + int rational; - bset = isl_aff_zero_basic_set(isl_aff_copy(pwaff->p[i].aff)); + rational = isl_set_has_rational(pwaff->p[i].set); + bset = aff_zero_basic_set(isl_aff_copy(pwaff->p[i].aff), + rational); zero = isl_set_from_basic_set(bset); set_i = isl_set_copy(pwaff->p[i].set); if (complement) -- 2.7.4