isl_pw_*_gist*: combine duplicate expressions to increase chance of single domain
[isl.git] / check_type_range_templ.c
blob4e4c1e2fc36ffc7211382c2f50c015a13de5c70d
1 #define xFN(TYPE,NAME) TYPE ## _ ## NAME
2 #define FN(TYPE,NAME) xFN(TYPE,NAME)
4 /* Check that there are "n" dimensions of type "type" starting at "first"
5 * in "obj".
6 */
7 isl_stat FN(TYPE,check_range)(__isl_keep TYPE *obj,
8 enum isl_dim_type type, unsigned first, unsigned n)
10 isl_size dim;
12 dim = FN(TYPE,dim)(obj, type);
13 if (dim < 0)
14 return isl_stat_error;
15 if (first + n > dim || first + n < first)
16 isl_die(FN(TYPE,get_ctx)(obj), isl_error_invalid,
17 "position or range out of bounds",
18 return isl_stat_error);
19 return isl_stat_ok;