diff options
author | Sven Verdoolaege <skimo@kotnet.org> | 2012-02-28 12:42:48 +0100 |
---|---|---|
committer | Sven Verdoolaege <skimo@kotnet.org> | 2012-05-06 14:33:05 +0200 |
commit | 1c21ead9b654e5996a62ba694c1292a86cdcada5 (patch) | |
tree | 3b0ac8deb0a41990f2c50b760e8d9c1c155876d1 /isl_constraint.c | |
parent | 84da31deb7d751f5ca0b5b4626955e8a6ba12418 (diff) | |
download | isl-1c21ead9b654e5996a62ba694c1292a86cdcada5.tar.gz isl-1c21ead9b654e5996a62ba694c1292a86cdcada5.tar.bz2 isl-1c21ead9b654e5996a62ba694c1292a86cdcada5.zip |
add isl_constraint_is_{lower,upper}_bound
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
Diffstat (limited to 'isl_constraint.c')
-rw-r--r-- | isl_constraint.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/isl_constraint.c b/isl_constraint.c index 68971b3d..a5c6e170 100644 --- a/isl_constraint.c +++ b/isl_constraint.c @@ -349,6 +349,40 @@ error: return -1; } +/* Does the given constraint represent a lower bound on the given + * dimension? + */ +int isl_constraint_is_lower_bound(__isl_keep isl_constraint *constraint, + enum isl_dim_type type, unsigned pos) +{ + if (!constraint) + return -1; + + if (pos >= isl_local_space_dim(constraint->ls, type)) + isl_die(isl_constraint_get_ctx(constraint), isl_error_invalid, + "position out of bounds", return -1); + + pos += isl_local_space_offset(constraint->ls, type); + return isl_int_is_pos(constraint->v->el[pos]); +} + +/* Does the given constraint represent an upper bound on the given + * dimension? + */ +int isl_constraint_is_upper_bound(__isl_keep isl_constraint *constraint, + enum isl_dim_type type, unsigned pos) +{ + if (!constraint) + return -1; + + if (pos >= isl_local_space_dim(constraint->ls, type)) + isl_die(isl_constraint_get_ctx(constraint), isl_error_invalid, + "position out of bounds", return -1); + + pos += isl_local_space_offset(constraint->ls, type); + return isl_int_is_neg(constraint->v->el[pos]); +} + const char *isl_constraint_get_dim_name(__isl_keep isl_constraint *constraint, enum isl_dim_type type, unsigned pos) { |