summaryrefslogtreecommitdiff
path: root/set_bitsets.c
diff options
context:
space:
mode:
authorAlex Auvolat--bernstein <auvolat@clipper.ens.fr>2013-12-04 16:34:15 +0100
committerAlex Auvolat--bernstein <auvolat@clipper.ens.fr>2013-12-04 16:34:15 +0100
commit77db931b94870a8f28eef482091924471cd18d64 (patch)
tree827ec4d9f3898a87bb7b51f430f532a03389f559 /set_bitsets.c
parent7cbbe99bca6c8dfccf3b85de8909ba94e2b03b44 (diff)
downloadAlgoProg-Projet-77db931b94870a8f28eef482091924471cd18d64.tar.gz
AlgoProg-Projet-77db931b94870a8f28eef482091924471cd18d64.zip
Algorithm B works.
Diffstat (limited to 'set_bitsets.c')
-rw-r--r--set_bitsets.c9
1 files changed, 5 insertions, 4 deletions
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);
}