X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=isl_scan.c;h=bc239c8f11f11a2d23481cbcb6dd8b99d94a82b1;hb=d7e5adb631b2a43c5c19cdc6e58b3345f87a530f;hp=05548b3f7584bf9ed57ab5f3b3c9a8ce65756c53;hpb=477e81423eddc76a08ed7c8a9f96a6754947f088;p=platform%2Fupstream%2Fisl.git diff --git a/isl_scan.c b/isl_scan.c index 05548b3..bc239c8 100644 --- a/isl_scan.c +++ b/isl_scan.c @@ -1,17 +1,18 @@ /* * 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 +#include #include "isl_basis_reduction.h" #include "isl_scan.h" #include #include "isl_tab.h" -#include struct isl_counter { struct isl_scan_callback callback; @@ -123,7 +124,7 @@ int isl_basic_set_scan(struct isl_basic_set *bset, if (!min || !max || !snap) goto error; - tab = isl_tab_from_basic_set(bset); + tab = isl_tab_from_basic_set(bset, 0); if (!tab) goto error; if (isl_tab_extend_cons(tab, dim + 1) < 0) @@ -242,6 +243,33 @@ error: return -1; } +int isl_basic_set_count_upto(__isl_keep isl_basic_set *bset, + isl_int max, isl_int *count) +{ + struct isl_counter cnt = { { &increment_counter } }; + + if (!bset) + return -1; + + isl_int_init(cnt.count); + isl_int_init(cnt.max); + + isl_int_set_si(cnt.count, 0); + isl_int_set(cnt.max, max); + if (isl_basic_set_scan(isl_basic_set_copy(bset), &cnt.callback) < 0 && + isl_int_lt(cnt.count, cnt.max)) + goto error; + + isl_int_set(*count, cnt.count); + isl_int_clear(cnt.max); + isl_int_clear(cnt.count); + + return 0; +error: + isl_int_clear(cnt.count); + return -1; +} + int isl_set_count_upto(__isl_keep isl_set *set, isl_int max, isl_int *count) { struct isl_counter cnt = { { &increment_counter } };