1 /*
2 * Copyright 2010 INRIA Saclay
3 *
4 * Use of this software is governed by the MIT license
5 *
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 */
10
11 #include <isl_pw_macro.h>
12
FN(PW,neg)13 __isl_give PW *FN(PW,neg)(__isl_take PW *pw)
14 {
15 int i;
16
17 if (!pw)
18 return NULL;
19
20 if (FN(PW,IS_ZERO)(pw))
21 return pw;
22
23 pw = FN(PW,cow)(pw);
24 if (!pw)
25 return NULL;
26
27 for (i = 0; i < pw->n; ++i) {
28 pw->p[i].FIELD = FN(EL,neg)(pw->p[i].FIELD);
29 if (!pw->p[i].FIELD)
30 return FN(PW,free)(pw);
31 }
32
33 return pw;
34 }
35