add private isl_*_list_dup
[platform/upstream/isl.git] / isl_pw_templ.c
index becec72..e89d4a3 100644 (file)
@@ -310,6 +310,31 @@ error:
        return NULL;
 }
 
+#ifndef NO_NEG
+__isl_give PW *FN(PW,neg)(__isl_take PW *pw)
+{
+       int i;
+
+       if (!pw)
+               return NULL;
+
+       if (FN(PW,IS_ZERO)(pw))
+               return pw;
+
+       pw = FN(PW,cow)(pw);
+       if (!pw)
+               return NULL;
+
+       for (i = 0; i < pw->n; ++i) {
+               pw->p[i].FIELD = FN(EL,neg)(pw->p[i].FIELD);
+               if (!pw->p[i].FIELD)
+                       return FN(PW,free)(pw);
+       }
+
+       return pw;
+}
+#endif
+
 #ifndef NO_EVAL
 __isl_give isl_qpolynomial *FN(PW,eval)(__isl_take PW *pw,
        __isl_take isl_point *pnt)