From: Sven Verdoolaege Date: Mon, 15 Dec 2008 20:22:27 +0000 (+0100) Subject: add isl_constraint_negate X-Git-Tag: isl-0.01~342 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=62be9f300c69569064e2adcb878bf67622bf1eaf;p=platform%2Fupstream%2Fisl.git add isl_constraint_negate --- diff --git a/include/isl_constraint.h b/include/isl_constraint.h index 5a021df..356039b 100644 --- a/include/isl_constraint.h +++ b/include/isl_constraint.h @@ -52,6 +52,7 @@ void isl_constraint_set_coefficient(struct isl_constraint *constraint, enum isl_dim_type type, int pos, isl_int v); void isl_constraint_clear(struct isl_constraint *constraint); +struct isl_constraint *isl_constraint_negate(struct isl_constraint *constraint); int isl_constraint_is_equality(struct isl_constraint *constraint); diff --git a/isl_constraint.c b/isl_constraint.c index ad2a467..e0eaeec 100644 --- a/isl_constraint.c +++ b/isl_constraint.c @@ -238,6 +238,26 @@ void isl_constraint_clear(struct isl_constraint *constraint) isl_seq_clr(constraint->line[0], 1 + total); } +struct isl_constraint *isl_constraint_negate(struct isl_constraint *constraint) +{ + unsigned total; + + if (!constraint) + return NULL; + + isl_assert(constraint->ctx, !isl_constraint_is_equality(constraint), + goto error); + isl_assert(constraint->ctx, constraint->bmap->ref == 1, goto error); + total = isl_basic_map_total_dim(constraint->bmap); + isl_seq_neg(constraint->line[0], constraint->line[0], 1 + total); + isl_int_sub_ui(constraint->line[0][0], constraint->line[0][0], 1); + F_CLR(constraint->bmap, ISL_BASIC_MAP_NORMALIZED); + return constraint; +error: + isl_constraint_free(constraint); + return NULL; +} + int isl_constraint_is_equality(struct isl_constraint *constraint) { if (!constraint)