105 static char rcsid[]
DD_UNUSED =
"$Id: cuddLevelQ.c,v 1.13 2009/03/08 02:49:02 fabio Exp $";
124 #if SIZEOF_VOID_P == 8 && SIZEOF_INT == 4
125 #define lqHash(key,shift) \
126 (((unsigned)(ptruint)(key) * DD_P1) >> (shift))
128 #define lqHash(key,shift) \
129 (((unsigned)(key) * DD_P1) >> (shift))
181 #pragma pointer_size save
182 #pragma pointer_size short
187 #pragma pointer_size restore
189 if (queue->
last == NULL) {
194 if (numBuckets < 2) numBuckets = 2;
197 queue->
shift =
sizeof(int) * 8 - logSize;
199 #pragma pointer_size save
200 #pragma pointer_size short
204 #pragma pointer_size restore
212 #pragma pointer_size save
213 #pragma pointer_size short
218 #pragma pointer_size restore
254 while (queue->
first != NULL) {
291 assert(level < queue->levels);
295 if (item != NULL)
return(item);
312 if (queue->
last[level]) {
320 while (plevel != 0 && queue->
last[plevel] == NULL)
322 if (queue->
last[plevel] == NULL) {
331 queue->
last[level] = item;
365 if (queue->
last[level] == item)
366 queue->
last[level] = NULL;
408 while (item != NULL) {
409 if (item->
key == key) {
442 if (result == 0)
return(0);
475 prevItem = queue->
buckets[posn];
477 if (prevItem == NULL)
return;
478 if (prevItem == item) {
483 while (prevItem->
cnext != NULL) {
484 if (prevItem->
cnext == item) {
488 prevItem = prevItem->
cnext;
517 #pragma pointer_size save
518 #pragma pointer_size short
523 #pragma pointer_size restore
531 numBuckets = oldNumBuckets << 1;
535 #pragma pointer_size save
536 #pragma pointer_size short
539 MMoutOfMemory = saveHandler;
540 if (buckets == NULL) {
546 shift = --(queue->
shift);
550 #pragma pointer_size restore
552 for (j = 0; j < oldNumBuckets; j++) {
553 item = oldBuckets[j];
554 while (item != NULL) {
557 item->
cnext = buckets[posn];
558 buckets[posn] = item;
void Cudd_OutOfMem(long size)
DdLevelQueue * cuddLevelQueueInit(int levels, int itemSize, int numBuckets)
void cuddLevelQueueDequeue(DdLevelQueue *queue, int level)
#define ABC_ALLOC(type, num)
static void hashDelete(DdLevelQueue *queue, DdQueueItem *item)
#define DD_MAX_SUBTABLE_DENSITY
struct DdQueueItem * next
void cuddLevelQueueQuit(DdLevelQueue *queue)
void * cuddLevelQueueEnqueue(DdLevelQueue *queue, void *key, int level)
int cuddComputeFloorLog2(unsigned int value)
#define ABC_NAMESPACE_IMPL_END
static int hashInsert(DdLevelQueue *queue, DdQueueItem *item)
static DdQueueItem * hashLookup(DdLevelQueue *queue, void *key)
static ABC_NAMESPACE_IMPL_START char rcsid[] DD_UNUSED
#define ABC_NAMESPACE_IMPL_START
static int hashResize(DdLevelQueue *queue)
#define lqHash(key, shift)
struct DdQueueItem * cnext