@@ -409,6 +409,24 @@ __isl_give isl_fixed_box *isl_map_get_range_simple_fixed_box_hull(
return box;
}
+/* Compute a fixed box from "set" using "map_box" by treating it as a map
+ * with a zero-dimensional domain and
+ * project out the domain again from the result.
+ */
+static __isl_give isl_fixed_box *fixed_box_as_map(__isl_keep isl_set *set,
+ __isl_give isl_fixed_box *(*map_box)(__isl_keep isl_map *map))
+{
+ isl_map *map;
+ isl_fixed_box *box;
+
+ map = isl_map_from_range(isl_set_copy(set));
+ box = map_box(map);
+ isl_map_free(map);
+ box = isl_fixed_box_project_domain_on_params(box);
+
+ return box;
+}
+
/* Try and construct a fixed-size rectangular box with an offset
* in terms of the parameters of "set" that contains "set".
* If no such box can be constructed, then return an invalidated box,
@@ -421,15 +439,7 @@ __isl_give isl_fixed_box *isl_map_get_range_simple_fixed_box_hull(
__isl_give isl_fixed_box *isl_set_get_simple_fixed_box_hull(
__isl_keep isl_set *set)
{
- isl_map *map;
- isl_fixed_box *box;
-
- map = isl_map_from_range(isl_set_copy(set));
- box = isl_map_get_range_simple_fixed_box_hull(map);
- isl_map_free(map);
- box = isl_fixed_box_project_domain_on_params(box);
-
- return box;
+ return fixed_box_as_map(set, &isl_map_get_range_simple_fixed_box_hull);
}
/* Check whether the output elements lie on a rectangular lattice,