[buddy] use powers of two for the sizes of all hash tables

* src/bddop.c, src/bddx.h, src/cache.c, src/cache.h, src/kernel.c,
src/kernel.h, src/prime.c, src/prime.h, src/reorder.c: Use power of
two for the sizes of all hash tables, in order to reduce the amount of
divisions performed.  Also allow bddhash to be smaller than bddnodes.
This commit is contained in:
Alexandre Duret-Lutz 2017-07-24 12:01:48 +02:00
parent 98e7e4e49a
commit 361b44e571
9 changed files with 48 additions and 25 deletions

View file

@ -244,6 +244,19 @@ unsigned int bdd_prime_lte(unsigned int src)
return src;
}
unsigned int bdd_nextpower(unsigned int v)
{
v--;
v |= v >> 1;
v |= v >> 2;
v |= v >> 4;
v |= v >> 8;
v |= v >> 16;
#if INT_MAX > 0x7FFFFFFF
v |= v >> 32;
#endif
return v + 1;
}
/*************************************************************************