From ca69c58b8d1acc61cd71b7c51ee47803af4d902f Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 30 Aug 2011 14:26:18 +0200 Subject: [PATCH] add isl_space_extend_domain_with_range Signed-off-by: Sven Verdoolaege --- isl_space.c | 18 ++++++++++++++++++ isl_space_private.h | 3 +++ 2 files changed, 21 insertions(+) diff --git a/isl_space.c b/isl_space.c index 5667dca6..7bac5784 100644 --- a/isl_space.c +++ b/isl_space.c @@ -1629,3 +1629,21 @@ error: isl_space_free(dim2); return NULL; } + +/* Given the space of set (domain), construct a space for a map + * with as domain the given space and as range the range of "model". + */ +__isl_give isl_space *isl_space_extend_domain_with_range( + __isl_take isl_space *domain, __isl_take isl_space *model) +{ + isl_space *space; + + space = isl_space_from_domain(domain); + space = isl_space_add_dims(space, isl_dim_out, + isl_space_dim(model, isl_dim_out)); + if (isl_space_has_tuple_id(model, isl_dim_out)) + space = isl_space_set_tuple_id(space, isl_dim_out, + isl_space_get_tuple_id(model, isl_dim_out)); + isl_space_free(model); + return space; +} diff --git a/isl_space_private.h b/isl_space_private.h index 28cb5864..73762de4 100644 --- a/isl_space_private.h +++ b/isl_space_private.h @@ -46,3 +46,6 @@ __isl_give isl_space *isl_space_replace(__isl_take isl_space *dst, enum isl_dim_type type, __isl_keep isl_space *src); __isl_give isl_space *isl_space_lift(__isl_take isl_space *dim, unsigned n_local); + +__isl_give isl_space *isl_space_extend_domain_with_range( + __isl_take isl_space *domain, __isl_take isl_space *model); -- 2.11.4.GIT