From bbf118d271fb69c7554bd7ff5b812b7172b5cd24 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Sun, 15 Jul 2012 10:17:37 +0200 Subject: [PATCH] isl_map_is_subset: support rational maps Signed-off-by: Sven Verdoolaege --- isl_map_subtract.c | 8 ++++++++ isl_test.c | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/isl_map_subtract.c b/isl_map_subtract.c index 4b95c7cd..3e07311f 100644 --- a/isl_map_subtract.c +++ b/isl_map_subtract.c @@ -775,6 +775,7 @@ static int map_is_singleton_subset(__isl_keep isl_map *map1, static int map_is_subset(__isl_keep isl_map *map1, __isl_keep isl_map *map2) { int is_subset = 0; + int rat1, rat2; if (!map1 || !map2) return -1; @@ -788,6 +789,13 @@ static int map_is_subset(__isl_keep isl_map *map1, __isl_keep isl_map *map2) if (isl_map_is_empty(map2)) return 0; + rat1 = isl_map_has_rational(map1); + rat2 = isl_map_has_rational(map2); + if (rat1 < 0 || rat2 < 0) + return -1; + if (rat1 && !rat2) + return 0; + if (isl_map_plain_is_universe(map2)) return 1; diff --git a/isl_test.c b/isl_test.c index 810768d3..a831b7da 100644 --- a/isl_test.c +++ b/isl_test.c @@ -2033,6 +2033,10 @@ struct { "191e1 <= 127i + 65e0 and 191e1 >= -190 + 127i + 65e0 and " "65e2 <= 3i + 61e1 and 65e2 >= -64 + 3i + 61e1 and " "61e3 <= 52i + 12e2 and 61e3 >= -60 + 52i + 12e2) }", 1 }, + { "{ [i] : 0 <= i <= 10 }", "{ rat: [i] : 0 <= i <= 10 }", 1 }, + { "{ rat: [i] : 0 <= i <= 10 }", "{ [i] : 0 <= i <= 10 }", 0 }, + { "{ rat: [0] }", "{ [i] : 0 <= i <= 10 }", 1 }, + { "{ rat: [(1)/2] }", "{ [i] : 0 <= i <= 10 }", 0 }, }; static int test_subset(isl_ctx *ctx) -- 2.11.4.GIT