isl_map_simplify.c: div_find_coalesce: return isl_size
[isl.git] / isl_pw_split_dims_templ.c
blob68e9165b61693cf2016d109444b3e5a3a419c792
1 /*
2 * Copyright 2010 INRIA Saclay
4 * Use of this software is governed by the MIT license
6 * Written by Sven Verdoolaege, INRIA Saclay - Ile-de-France,
7 * Parc Club Orsay Universite, ZAC des vignes, 4 rue Jacques Monod,
8 * 91893 Orsay, France
9 */
11 #include <isl_pw_macro.h>
13 __isl_give PW *FN(PW,split_dims)(__isl_take PW *pw,
14 enum isl_dim_type type, unsigned first, unsigned n)
16 int i;
17 isl_size n_piece;
19 n_piece = FN(PW,n_piece)(pw);
20 if (n_piece < 0)
21 return FN(PW,free)(pw);
22 if (n == 0)
23 return pw;
25 if (type == isl_dim_in)
26 type = isl_dim_set;
28 for (i = 0; i < n; ++i) {
29 isl_set *domain;
31 domain = FN(PW,take_domain_at)(pw, i);
32 domain = isl_set_split_dims(domain, type, first, n);
33 pw = FN(PW,restore_domain_at)(pw, i, domain);
36 return pw;