isl_pw_templ.c: extract out isl_pw_neg_templ.c
authorSven Verdoolaege <sven.verdoolaege@gmail.com>
Sun, 4 Aug 2019 17:34:49 +0000 (4 19:34 +0200)
committerSven Verdoolaege <sven.verdoolaege@gmail.com>
Sun, 24 Nov 2019 14:56:34 +0000 (24 15:56 +0100)
This makes the function isl_pw_*_neg opt-in rather than opt-out.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
Makefile.am
isl_aff.c
isl_fold.c
isl_polynomial.c
isl_pw_neg_templ.c [new file with mode: 0644]
isl_pw_templ.c

index ef240ae..fedfb79 100644 (file)
@@ -520,6 +520,7 @@ EXTRA_DIST = \
        isl_pw_hash.c \
        isl_pw_lift_templ.c \
        isl_pw_morph_templ.c \
+       isl_pw_neg_templ.c \
        isl_pw_pullback_templ.c \
        isl_pw_union_opt.c \
        read_in_string_templ.c \
index 9f2694e..c38088d 100644 (file)
--- a/isl_aff.c
+++ b/isl_aff.c
@@ -2736,6 +2736,7 @@ static __isl_give isl_aff *isl_aff_zero_in_space(__isl_take isl_space *space)
 #include <isl_pw_bind_domain_templ.c>
 #include <isl_pw_eval.c>
 #include <isl_pw_hash.c>
+#include <isl_pw_neg_templ.c>
 #include <isl_pw_pullback_templ.c>
 #include <isl_pw_union_opt.c>
 
@@ -4369,6 +4370,7 @@ __isl_give isl_set *isl_multi_aff_lex_gt_set(__isl_take isl_multi_aff *ma1,
 
 #include <isl_pw_templ.c>
 #include <isl_pw_bind_domain_templ.c>
+#include <isl_pw_neg_templ.c>
 #include <isl_pw_pullback_templ.c>
 #include <isl_pw_union_opt.c>
 
index d90b832..f74a7b2 100644 (file)
@@ -699,7 +699,6 @@ static __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_zero_in_space(
 #undef DEFAULT_IS_ZERO
 #define DEFAULT_IS_ZERO 1
 
-#define NO_NEG
 #define NO_SUB
 
 #include <isl_pw_templ.c>
index 435d1f6..6a8fdf9 100644 (file)
@@ -3096,6 +3096,7 @@ static __isl_give isl_qpolynomial *isl_qpolynomial_zero_in_space(
 #include <isl_pw_eval.c>
 #include <isl_pw_lift_templ.c>
 #include <isl_pw_morph_templ.c>
+#include <isl_pw_neg_templ.c>
 
 #undef BASE
 #define BASE pw_qpolynomial
diff --git a/isl_pw_neg_templ.c b/isl_pw_neg_templ.c
new file mode 100644 (file)
index 0000000..65970cf
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2010      INRIA Saclay
+ *
+ * Use of this software is governed by the MIT license
+ *
+ * Written by Sven Verdoolaege, INRIA Saclay - Ile-de-France,
+ * Parc Club Orsay Universite, ZAC des vignes, 4 rue Jacques Monod,
+ * 91893 Orsay, France
+ */
+
+#include <isl_pw_macro.h>
+
+__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;
+}
index 634c527..e9ec630 100644 (file)
@@ -689,31 +689,6 @@ 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_SUB
 __isl_give PW *FN(PW,sub)(__isl_take PW *pw1, __isl_take PW *pw2)
 {