From e02e086527c8d8786b88c24ab39a4ddc0a4b03dd Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 31 May 2013 11:21:19 +0200 Subject: [PATCH] extract out shared isl_term_check_range Signed-off-by: Sven Verdoolaege --- isl_polynomial.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/isl_polynomial.c b/isl_polynomial.c index 7ae74876..f9600b05 100644 --- a/isl_polynomial.c +++ b/isl_polynomial.c @@ -3822,14 +3822,17 @@ __isl_give isl_val *isl_term_get_coefficient_val(__isl_keep isl_term *term) term->n, term->d); } +#undef TYPE +#define TYPE isl_term +static +#include "check_type_range_templ.c" + int isl_term_get_exp(__isl_keep isl_term *term, enum isl_dim_type type, unsigned pos) { - if (!term) + if (isl_term_check_range(term, type, pos, 1) < 0) return -1; - isl_assert(term->dim->ctx, pos < isl_term_dim(term, type), return -1); - if (type >= isl_dim_set) pos += isl_space_dim(term->dim, isl_dim_param); if (type >= isl_dim_div) @@ -3843,12 +3846,9 @@ __isl_give isl_aff *isl_term_get_div(__isl_keep isl_term *term, unsigned pos) isl_local_space *ls; isl_aff *aff; - if (!term) + if (isl_term_check_range(term, isl_dim_div, pos, 1) < 0) return NULL; - isl_assert(term->dim->ctx, pos < isl_term_dim(term, isl_dim_div), - return NULL); - ls = isl_local_space_alloc_div(isl_space_copy(term->dim), isl_mat_copy(term->div)); aff = isl_aff_alloc(ls); -- 2.11.4.GIT