From f6ce07eefeeb0fe365c1252a2d05481b345dd13b Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Mon, 5 Jun 2023 13:46:36 +0200 Subject: [PATCH] isl_aff_domain_offset: extract out isl_aff_domain_var_offset isl_aff_domain_offset returns the position of the coefficients of a given type in the domain, while in some cases it is more convenient to think in terms of the position among the variables of the domain. isl_aff_domain_var_offset returns this position. Signed-off-by: Sven Verdoolaege --- isl_aff.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/isl_aff.c b/isl_aff.c index 1677c135..f04159a1 100644 --- a/isl_aff.c +++ b/isl_aff.c @@ -517,16 +517,26 @@ isl_size isl_aff_dim(__isl_keep isl_aff *aff, enum isl_dim_type type) return isl_aff_domain_dim(aff, type); } +/* Return the offset of the first variable of type "type" within + * the variables of the domain of "aff". + */ +static isl_size isl_aff_domain_var_offset(__isl_keep isl_aff *aff, + enum isl_dim_type type) +{ + isl_local_space *ls; + + ls = isl_aff_peek_domain_local_space(aff); + return isl_local_space_var_offset(ls, type); +} + /* Return the offset of the first coefficient of type "type" in * the domain of "aff". */ isl_size isl_aff_domain_offset(__isl_keep isl_aff *aff, enum isl_dim_type type) { - isl_local_space *ls; isl_size offset; - ls = isl_aff_peek_domain_local_space(aff); - offset = isl_local_space_var_offset(ls, type); + offset = isl_aff_domain_var_offset(aff, type); if (offset < 0) return isl_size_error; return 1 + offset; -- 2.11.4.GIT