temporarily make isl_val_int_from_isl_int available
[platform/upstream/isl.git] / isl_scan.c
index bc239c8..a7d2b9f 100644 (file)
@@ -13,6 +13,7 @@
 #include "isl_scan.h"
 #include <isl/seq.h>
 #include "isl_tab.h"
+#include <isl_val_private.h>
 
 struct isl_counter {
        struct isl_scan_callback callback;
@@ -302,3 +303,21 @@ int isl_set_count(__isl_keep isl_set *set, isl_int *count)
                return -1;
        return isl_set_count_upto(set, set->ctx->zero, count);
 }
+
+/* Count the total number of elements in "set" (in an inefficient way) and
+ * return the result.
+ */
+__isl_give isl_val *isl_set_count_val(__isl_keep isl_set *set)
+{
+       isl_val *v;
+
+       if (!set)
+               return NULL;
+       v = isl_val_zero(isl_set_get_ctx(set));
+       v = isl_val_cow(v);
+       if (!v)
+               return NULL;
+       if (isl_set_count(set, &v->n) < 0)
+               v = isl_val_free(v);
+       return v;
+}