add isl_pw_aff_set_rational
authorSven Verdoolaege <skimo@kotnet.org>
Mon, 16 Jul 2012 17:27:24 +0000 (19:27 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Tue, 18 Sep 2012 13:08:20 +0000 (15:08 +0200)
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
isl_aff.c
isl_aff_private.h

index a5c25f9..41bee5c 100644 (file)
--- a/isl_aff.c
+++ b/isl_aff.c
@@ -2509,6 +2509,27 @@ __isl_give isl_pw_aff *isl_pw_aff_list_max(__isl_take isl_pw_aff_list *list)
        return pw_aff_list_reduce(list, &isl_pw_aff_max);
 }
 
+/* Mark the domains of "pwaff" as rational.
+ */
+__isl_give isl_pw_aff *isl_pw_aff_set_rational(__isl_take isl_pw_aff *pwaff)
+{
+       int i;
+
+       pwaff = isl_pw_aff_cow(pwaff);
+       if (!pwaff)
+               return NULL;
+       if (pwaff->n == 0)
+               return pwaff;
+
+       for (i = 0; i < pwaff->n; ++i) {
+               pwaff->p[i].set = isl_set_set_rational(pwaff->p[i].set);
+               if (!pwaff->p[i].set)
+                       return isl_pw_aff_free(pwaff);
+       }
+
+       return pwaff;
+}
+
 #undef BASE
 #define BASE aff
 
index 770b73b..546a368 100644 (file)
@@ -74,6 +74,8 @@ __isl_give isl_pw_aff *isl_pw_aff_add_disjoint(
 __isl_give isl_pw_aff *isl_pw_aff_union_opt(__isl_take isl_pw_aff *pwaff1,
        __isl_take isl_pw_aff *pwaff2, int max);
 
+__isl_give isl_pw_aff *isl_pw_aff_set_rational(__isl_take isl_pw_aff *pwaff);
+
 #undef BASE
 #define BASE aff