This makes the function isl_pw_*_neg opt-in rather than opt-out.
Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
@@ -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 \
@@ -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>
@@ -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>
@@ -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
--- /dev/null
+/*
+ * 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;
+}
@@ -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)
{