[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:
parent
98e7e4e49a
commit
361b44e571
9 changed files with 48 additions and 25 deletions
|
|
@ -36,6 +36,7 @@
|
|||
*************************************************************************/
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include "kernel.h"
|
||||
#include "cache.h"
|
||||
#include "prime.h"
|
||||
|
|
@ -50,9 +51,10 @@ void BddCache_reset(BddCache *cache)
|
|||
cache->table[n].i.a = -1;
|
||||
}
|
||||
|
||||
|
||||
int BddCache_init(BddCache *cache, int size)
|
||||
{
|
||||
size = bdd_prime_gte(size);
|
||||
size = bdd_nextpower(size);
|
||||
|
||||
if ((cache->table=NEW(BddCacheData,size)) == NULL)
|
||||
return bdd_error(BDD_MEMORY);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue