add isl_set_fix
authorSven Verdoolaege <skimo@kotnet.org>
Wed, 21 Oct 2009 12:04:29 +0000 (14:04 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Wed, 21 Oct 2009 20:58:47 +0000 (22:58 +0200)
include/isl_set.h
isl_map.c

index e5c63ac..944041f 100644 (file)
@@ -199,6 +199,8 @@ __isl_give isl_set *isl_set_subtract(
 __isl_give isl_set *isl_set_apply(
                __isl_take isl_set *set,
                __isl_take isl_map *map);
+__isl_give isl_set *isl_set_fix(__isl_take isl_set *set,
+               enum isl_dim_type type, unsigned pos, isl_int value);
 struct isl_set *isl_set_fix_dim_si(struct isl_set *set,
                unsigned dim, int value);
 struct isl_set *isl_set_lower_bound_dim(struct isl_set *set,
index c642ec3..3cbfdf8 100644 (file)
--- a/isl_map.c
+++ b/isl_map.c
@@ -3195,6 +3195,34 @@ error:
        return NULL;
 }
 
+__isl_give isl_map *isl_map_fix(__isl_take isl_map *map,
+               enum isl_dim_type type, unsigned pos, isl_int value)
+{
+       int i;
+
+       map = isl_map_cow(map);
+       if (!map)
+               return NULL;
+
+       isl_assert(map->ctx, pos < isl_map_dim(map, type), goto error);
+       for (i = 0; i < map->n; ++i) {
+               map->p[i] = isl_basic_map_fix(map->p[i], type, pos, value);
+               if (!map->p[i])
+                       goto error;
+       }
+       ISL_F_CLR(map, ISL_MAP_NORMALIZED);
+       return map;
+error:
+       isl_map_free(map);
+       return NULL;
+}
+
+__isl_give isl_set *isl_set_fix(__isl_take isl_set *set,
+               enum isl_dim_type type, unsigned pos, isl_int value)
+{
+       return (struct isl_set *)isl_map_fix((isl_map *)set, type, pos, value);
+}
+
 struct isl_map *isl_map_fix_input_si(struct isl_map *map,
                unsigned input, int value)
 {