From: Sven Verdoolaege Date: Tue, 14 Sep 2010 04:29:03 +0000 (+0200) Subject: merge isl_basic_set_drop_constraints_involving implementations X-Git-Tag: isl-0.05~165 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c684962ceb5dfbbc7a3f8f0e9a1e8ad7d52dd32f;p=platform%2Fupstream%2Fisl.git merge isl_basic_set_drop_constraints_involving implementations Signed-off-by: Sven Verdoolaege --- diff --git a/isl_affine_hull.c b/isl_affine_hull.c index 894670b..cc4baf0 100644 --- a/isl_affine_hull.c +++ b/isl_affine_hull.c @@ -417,16 +417,19 @@ error: /* Drop all constraints in bset that involve any of the dimensions * first to first+n-1. */ -static struct isl_basic_set *drop_constraints_involving - (struct isl_basic_set *bset, unsigned first, unsigned n) +__isl_give isl_basic_set *isl_basic_set_drop_constraints_involving( + __isl_take isl_basic_set *bset, unsigned first, unsigned n) { int i; - if (!bset) - return NULL; + if (n == 0) + return bset; bset = isl_basic_set_cow(bset); + if (!bset) + return NULL; + for (i = bset->n_eq - 1; i >= 0; --i) { if (isl_seq_first_non_zero(bset->eq[i] + 1 + first, n) == -1) continue; @@ -703,7 +706,8 @@ static struct isl_basic_set *affine_hull_with_cone(struct isl_basic_set *bset, U = isl_mat_lin_to_aff(U); bset = isl_basic_set_preimage(bset, isl_mat_copy(U)); - bset = drop_constraints_involving(bset, total - cone_dim, cone_dim); + bset = isl_basic_set_drop_constraints_involving(bset, total - cone_dim, + cone_dim); bset = isl_basic_set_drop_dims(bset, total - cone_dim, cone_dim); Q = isl_mat_lin_to_aff(Q); diff --git a/isl_map_private.h b/isl_map_private.h index 93923cb..11fedea 100644 --- a/isl_map_private.h +++ b/isl_map_private.h @@ -129,6 +129,8 @@ __isl_give isl_basic_set *isl_basic_set_underlying_set( struct isl_set *isl_map_underlying_set(struct isl_map *map); struct isl_basic_map *isl_basic_map_overlying_set(struct isl_basic_set *bset, struct isl_basic_map *like); +__isl_give isl_basic_set *isl_basic_set_drop_constraints_involving( + __isl_take isl_basic_set *bset, unsigned first, unsigned n); __isl_give isl_basic_set *isl_basic_set_drop(__isl_take isl_basic_set *bset, enum isl_dim_type type, unsigned first, unsigned n); struct isl_basic_map *isl_basic_map_drop(struct isl_basic_map *bmap, diff --git a/isl_sample.c b/isl_sample.c index 986b5a7..8413a2f 100644 --- a/isl_sample.c +++ b/isl_sample.c @@ -827,28 +827,6 @@ error: return NULL; } -/* Drop all constraints in bset that involve any of the dimensions - * first to first+n-1. - */ -static struct isl_basic_set *drop_constraints_involving - (struct isl_basic_set *bset, unsigned first, unsigned n) -{ - int i; - - bset = isl_basic_set_cow(bset); - - if (!bset) - return NULL; - - for (i = bset->n_ineq - 1; i >= 0; --i) { - if (isl_seq_first_non_zero(bset->ineq[i] + 1 + first, n) == -1) - continue; - isl_basic_set_drop_inequality(bset, i); - } - - return bset; -} - /* Give a basic set "bset" with recession cone "cone", compute and * return an integer point in bset, if any. * @@ -914,7 +892,8 @@ __isl_give isl_vec *isl_basic_set_sample_with_cone( bset = isl_basic_set_preimage(bset, isl_mat_copy(U)); bounded = isl_basic_set_copy(bset); - bounded = drop_constraints_involving(bounded, total - cone_dim, cone_dim); + bounded = isl_basic_set_drop_constraints_involving(bounded, + total - cone_dim, cone_dim); bounded = isl_basic_set_drop_dims(bounded, total - cone_dim, cone_dim); sample = sample_bounded(bounded); if (!sample || sample->size == 0) {