From 77db931b94870a8f28eef482091924471cd18d64 Mon Sep 17 00:00:00 2001 From: Alex Auvolat--bernstein Date: Wed, 4 Dec 2013 16:34:15 +0100 Subject: Algorithm B works. --- set_bitsets.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'set_bitsets.c') diff --git a/set_bitsets.c b/set_bitsets.c index 6645e0e..30e4dc9 100644 --- a/set_bitsets.c +++ b/set_bitsets.c @@ -48,7 +48,7 @@ set empty_set(int n){ set copy_set(const set s){ set res = empty_set(s.N); *(res.size) = *(s.size); - int NC = nbCells(*(s.size)), i; + int NC = nbCells(s.N), i; for(i = 0; i < NC; i++) res.tab[i] = s.tab[i]; return res; @@ -64,7 +64,7 @@ void set_union_ip(set a, const set b){ printf("Union failed : the sets don't have the same size\n"); assert(a.N == b.N); } - int NC = nbCells(*(a.size)), i; + int NC = nbCells(a.N), i; *(a.size)=0; for(i = 0; i < NC; i++) { a.tab[i] = a.tab[i]|b.tab[i]; @@ -77,7 +77,7 @@ void set_inter_ip(set a, const set b){ printf("Intersection failed : the sets don't have the same size\n"); assert(a.N == b.N); } - int NC = nbCells(*(a.size)), i; + int NC = nbCells(a.N), i; *(a.size)=0; for(i = 0; i < NC; i++){ a.tab[i] = a.tab[i]&b.tab[i]; @@ -91,7 +91,7 @@ void set_diff_ip(set a, const set b){ printf("Difference failed : the sets don't have the same size\n"); assert(a.N == b.N); } - int NC = nbCells(*(a.size)), i; + int NC = nbCells(a.N), i; for(i = 0; i < NC; i++) { a.tab[i] = a.tab[i] & (~b.tab[i]); *(a.size) += nb_one(a.tab[i]); @@ -125,6 +125,7 @@ int elt_of_set(const set s){ return i*SCOD+dyadic_val(s.tab[i]); printf("No element in an empty set!\n"); + dump_set(s); assert(false); } -- cgit v1.2.3