[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
|
|
@ -57,7 +57,7 @@ typedef union
|
|||
typedef struct
|
||||
{
|
||||
BddCacheData *table;
|
||||
int tablesize;
|
||||
int tablesize; /* a power of 2 */
|
||||
} BddCache;
|
||||
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ extern void BddCache_done(BddCache *);
|
|||
extern int BddCache_resize(BddCache *, int);
|
||||
extern void BddCache_reset(BddCache *);
|
||||
|
||||
#define BddCache_lookup(cache, hash) (&(cache)->table[hash % (cache)->tablesize])
|
||||
#define BddCache_lookup(cache, hash) (&(cache)->table[hash & ((cache)->tablesize - 1)])
|
||||
|
||||
|
||||
#endif /* _CACHE_H */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue