summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Verdoolaege <skimo@kotnet.org>2013-05-28 11:44:19 +0200
committerSven Verdoolaege <skimo@kotnet.org>2013-05-28 20:42:49 +0200
commit8cc739d3615dff84e4f54a836f5fe4c7f8c8259b (patch)
tree6e59b23367d13b744d607e447d58a5c4e27b4677
parent82e48de0422ba8469fa52009563a2a686cb73145 (diff)
downloadisl-8cc739d3615dff84e4f54a836f5fe4c7f8c8259b.tar.gz
isl-8cc739d3615dff84e4f54a836f5fe4c7f8c8259b.tar.bz2
isl-8cc739d3615dff84e4f54a836f5fe4c7f8c8259b.zip
add isl_vec_cmp_element
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
-rw-r--r--doc/user.pod2
-rw-r--r--include/isl/vec.h2
-rw-r--r--isl_vec.c13
3 files changed, 17 insertions, 0 deletions
diff --git a/doc/user.pod b/doc/user.pod
index 6e665a38..54686210 100644
--- a/doc/user.pod
+++ b/doc/user.pod
@@ -3547,6 +3547,8 @@ The elements can be changed and inspected using the following functions.
int v);
__isl_give isl_vec *isl_vec_set_val(
__isl_take isl_vec *vec, __isl_take isl_val *v);
+ int isl_vec_cmp_element(__isl_keep isl_vec *vec1,
+ __isl_keep isl_vec *vec2, int pos);
__isl_give isl_vec *isl_vec_fdiv_r(__isl_take isl_vec *vec,
isl_int m);
diff --git a/include/isl/vec.h b/include/isl/vec.h
index 2614db24..ad1309cb 100644
--- a/include/isl/vec.h
+++ b/include/isl/vec.h
@@ -52,6 +52,8 @@ __isl_give isl_vec *isl_vec_set_element_val(__isl_take isl_vec *vec,
int pos, __isl_take isl_val *v);
int isl_vec_is_equal(__isl_keep isl_vec *vec1, __isl_keep isl_vec *vec2);
+int isl_vec_cmp_element(__isl_keep isl_vec *vec1, __isl_keep isl_vec *vec2,
+ int pos);
void isl_vec_dump(__isl_keep isl_vec *vec);
__isl_give isl_printer *isl_printer_print_vec(__isl_take isl_printer *printer,
diff --git a/isl_vec.c b/isl_vec.c
index 3cf21c99..f6d5a874 100644
--- a/isl_vec.c
+++ b/isl_vec.c
@@ -254,6 +254,19 @@ error:
return isl_vec_free(vec);
}
+/* Compare the elements of "vec1" and "vec2" at position "pos".
+ */
+int isl_vec_cmp_element(__isl_keep isl_vec *vec1, __isl_keep isl_vec *vec2,
+ int pos)
+{
+ if (!vec1 || !vec2)
+ return 0;
+ if (pos < 0 || pos >= vec1->size || pos >= vec2->size)
+ isl_die(isl_vec_get_ctx(vec1), isl_error_invalid,
+ "position out of range", return 0);
+ return isl_int_cmp(vec1->el[pos], vec2->el[pos]);
+}
+
int isl_vec_is_equal(__isl_keep isl_vec *vec1, __isl_keep isl_vec *vec2)
{
if (!vec1 || !vec2)