interface: update to move of llvm/Support/Host.h to llvm/TargetParser/Host.h
[isl.git] / isl_pw_un_op_templ.c
blob114609012edbecd0bec4ee14c3891dd2ccdf968b
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 /* Apply "fn" to each of the base expressions of "pw".
14 * The function is assumed to have no effect on the default value
15 * (i.e., zero for those objects with a default value).
17 static __isl_give PW *FN(PW,un_op)(__isl_take PW *pw,
18 __isl_give EL *(*fn)(__isl_take EL *el))
20 isl_size n;
21 int i;
23 n = FN(PW,n_piece)(pw);
24 if (n < 0)
25 return FN(PW,free)(pw);
27 for (i = 0; i < n; ++i) {
28 EL *el;
30 el = FN(PW,take_base_at)(pw, i);
31 el = fn(el);
32 pw = FN(PW,restore_base_at)(pw, i, el);
35 return pw;