isl_basic_map_swap_div: extract out swap_div
authorSven Verdoolaege <skimo@kotnet.org>
Sun, 17 Mar 2013 19:49:31 +0000 (20:49 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Sun, 17 Mar 2013 19:50:01 +0000 (20:50 +0100)
The new swap_div will be reused in a subsequent commit.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
isl_map.c

index 66fdc5c..47f3aa7 100644 (file)
--- a/isl_map.c
+++ b/isl_map.c
@@ -1673,13 +1673,25 @@ struct isl_basic_set *isl_basic_set_set_to_empty(struct isl_basic_set *bset)
                isl_basic_map_set_to_empty((struct isl_basic_map *)bset);
 }
 
-void isl_basic_map_swap_div(struct isl_basic_map *bmap, int a, int b)
+/* Swap divs "a" and "b" in "bmap" (without modifying any of the constraints
+ * of "bmap").
+ */
+static void swap_div(__isl_keep isl_basic_map *bmap, int a, int b)
 {
-       int i;
-       unsigned off = isl_space_dim(bmap->dim, isl_dim_all);
        isl_int *t = bmap->div[a];
        bmap->div[a] = bmap->div[b];
        bmap->div[b] = t;
+}
+
+/* Swap divs "a" and "b" in "bmap" and adjust the constraints and
+ * div definitions accordingly.
+ */
+void isl_basic_map_swap_div(struct isl_basic_map *bmap, int a, int b)
+{
+       int i;
+       unsigned off = isl_space_dim(bmap->dim, isl_dim_all);
+
+       swap_div(bmap, a, b);
 
        for (i = 0; i < bmap->n_eq; ++i)
                isl_int_swap(bmap->eq[i][1+off+a], bmap->eq[i][1+off+b]);