change calling convention of isl_basic_map_div
authorSven Verdoolaege <skimo@kotnet.org>
Sun, 22 Mar 2009 17:19:32 +0000 (18:19 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Mon, 23 Mar 2009 09:00:20 +0000 (10:00 +0100)
include/isl_div.h
isl_constraint.c
isl_div.c

index 7d699d7..c7a6d51 100644 (file)
@@ -16,7 +16,7 @@ struct isl_div {
 };
 
 struct isl_div *isl_div_alloc(struct isl_dim *dim);
-struct isl_div *isl_basic_map_div(struct isl_basic_map *bmap, isl_int **line);
+struct isl_div *isl_basic_map_div(struct isl_basic_map *bmap, int pos);
 struct isl_div *isl_div_free(struct isl_div *c);
 
 void isl_div_get_constant(struct isl_div *div, isl_int *v);
index 8d38f97..7383988 100644 (file)
@@ -264,8 +264,7 @@ struct isl_div *isl_constraint_div(struct isl_constraint *constraint, int pos)
 
        isl_assert(constraint->ctx, pos < n(constraint, isl_dim_div),
                        return NULL);
-       return isl_basic_map_div(isl_basic_map_copy(constraint->bmap),
-                                constraint->bmap->div+pos);
+       return isl_basic_map_div(isl_basic_map_copy(constraint->bmap), pos);
 }
 
 void isl_constraint_set_constant(struct isl_constraint *constraint, isl_int v)
index a15cda8..f9ee633 100644 (file)
--- a/isl_div.c
+++ b/isl_div.c
@@ -24,12 +24,14 @@ static unsigned offset(struct isl_div *d, enum isl_dim_type type)
        }
 }
 
-struct isl_div *isl_basic_map_div(struct isl_basic_map *bmap, isl_int **line)
+struct isl_div *isl_basic_map_div(struct isl_basic_map *bmap, int pos)
 {
        struct isl_div *div;
 
-       if (!bmap || !line)
+       if (!bmap)
                goto error;
+
+       isl_assert(bmap->ctx, pos < bmap->n_div, goto error);
        
        div = isl_alloc_type(bmap->ctx, struct isl_div);
        if (!div)
@@ -39,7 +41,7 @@ struct isl_div *isl_basic_map_div(struct isl_basic_map *bmap, isl_int **line)
        isl_ctx_ref(div->ctx);
        div->ref = 1;
        div->bmap = bmap;
-       div->line = line;
+       div->line = &bmap->div[pos];
 
        return div;
 error:
@@ -60,7 +62,7 @@ struct isl_div *isl_div_alloc(struct isl_dim *dim)
 
        isl_basic_map_alloc_div(bmap);
        isl_seq_clr(bmap->div[0], 1 + 1 + isl_basic_map_total_dim(bmap));
-       return isl_basic_map_div(bmap, &bmap->div[0]);
+       return isl_basic_map_div(bmap, 0);
 }
 
 struct isl_div *isl_div_free(struct isl_div *c)