From 4c34a18e36ab342501158d173d6f7ecc40f1d266 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 17 Aug 2018 10:34:39 +0200 Subject: [PATCH] isl_qpolynomial_drop_dims: use isl_qpolynomial_domain_var_offset This reduces the dependence on the internal representation. Signed-off-by: Sven Verdoolaege --- isl_polynomial.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/isl_polynomial.c b/isl_polynomial.c index 084a1f44..4e242147 100644 --- a/isl_polynomial.c +++ b/isl_polynomial.c @@ -2857,6 +2857,8 @@ __isl_give isl_qpolynomial *isl_qpolynomial_drop_dims( __isl_take isl_qpolynomial *qp, enum isl_dim_type type, unsigned first, unsigned n) { + int offset; + if (!qp) return NULL; if (type == isl_dim_out) @@ -2880,8 +2882,10 @@ __isl_give isl_qpolynomial *isl_qpolynomial_drop_dims( if (!qp->dim) goto error; - if (type == isl_dim_set) - first += isl_space_dim(qp->dim, isl_dim_param); + offset = isl_qpolynomial_domain_var_offset(qp, type); + if (offset < 0) + goto error; + first += offset; qp->div = isl_mat_drop_cols(qp->div, 2 + first, n); if (!qp->div) -- 2.11.4.GIT