/*
* Copyright 2008-2009 Katholieke Universiteit Leuven
*
- * Use of this software is governed by the GNU LGPLv2.1 license
+ * Use of this software is governed by the MIT license
*
* Written by Sven Verdoolaege, K.U.Leuven, Departement
* Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
#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;
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;
+}