File: check_type_range_templ.c

package info (click to toggle)
isl 0.27-1
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 20,476 kB
  • sloc: ansic: 230,339; python: 19,348; cpp: 7,165; sh: 4,701; makefile: 767; lisp: 207; perl: 9
file content (20 lines) | stat: -rw-r--r-- 547 bytes parent folder | download | duplicates (27)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#define xFN(TYPE,NAME) TYPE ## _ ## NAME
#define FN(TYPE,NAME) xFN(TYPE,NAME)

/* Check that there are "n" dimensions of type "type" starting at "first"
 * in "obj".
 */
isl_stat FN(TYPE,check_range)(__isl_keep TYPE *obj,
	enum isl_dim_type type, unsigned first, unsigned n)
{
	isl_size dim;

	dim = FN(TYPE,dim)(obj, type);
	if (dim < 0)
		return isl_stat_error;
	if (first + n > dim || first + n < first)
		isl_die(FN(TYPE,get_ctx)(obj), isl_error_invalid,
			"position or range out of bounds",
			return isl_stat_error);
	return isl_stat_ok;
}