summaryrefslogtreecommitdiffstats
path: root/src/bdd/cudd/cuddReorder.c
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2011-12-06 17:48:31 -0800
committerAlan Mishchenko <alanmi@berkeley.edu>2011-12-06 17:48:31 -0800
commit780321cf54b8da33be6800ea4533d3f8176fd822 (patch)
tree5d2d13b8832a5608e110f439146bbecd328a4de3 /src/bdd/cudd/cuddReorder.c
parent7cce97b4b305c4fc4593f8426648228c3ca63b82 (diff)
downloadabc-780321cf54b8da33be6800ea4533d3f8176fd822.tar.gz
abc-780321cf54b8da33be6800ea4533d3f8176fd822.tar.bz2
abc-780321cf54b8da33be6800ea4533d3f8176fd822.zip
Another attempt to make CUDD platform- and runtime-independent.
Diffstat (limited to 'src/bdd/cudd/cuddReorder.c')
-rw-r--r--src/bdd/cudd/cuddReorder.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/bdd/cudd/cuddReorder.c b/src/bdd/cudd/cuddReorder.c
index 383be18a..f9c08772 100644
--- a/src/bdd/cudd/cuddReorder.c
+++ b/src/bdd/cudd/cuddReorder.c
@@ -416,7 +416,8 @@ cuddDynamicAllocNode(
/* Try to allocate a new block. */
saveHandler = MMoutOfMemory;
MMoutOfMemory = Cudd_OutOfMem;
- mem = (DdNodePtr *) ABC_ALLOC(DdNode, DD_MEM_CHUNK + 1);
+// mem = (DdNodePtr *) ABC_ALLOC(DdNode, DD_MEM_CHUNK + 1);
+ mem = (DdNodePtr *) ABC_ALLOC(DdNode, DD_MEM_CHUNK + 2);
MMoutOfMemory = saveHandler;
if (mem == NULL && table->stash != NULL) {
ABC_FREE(table->stash);
@@ -427,7 +428,8 @@ cuddDynamicAllocNode(
for (i = 0; i < table->size; i++) {
table->subtables[i].maxKeys <<= 2;
}
- mem = (DdNodePtr *) ABC_ALLOC(DdNode,DD_MEM_CHUNK + 1);
+// mem = (DdNodePtr *) ABC_ALLOC(DdNode,DD_MEM_CHUNK + 1);
+ mem = (DdNodePtr *) ABC_ALLOC(DdNode,DD_MEM_CHUNK + 2);
}
if (mem == NULL) {
/* Out of luck. Call the default handler to do
@@ -453,10 +455,13 @@ cuddDynamicAllocNode(
** power of 2 and a multiple of the size of a pointer.
** If we align one node, all the others will be aligned
** as well. */
- offset = (unsigned long) mem & (sizeof(DdNode) - 1);
- mem += (sizeof(DdNode) - offset) / sizeof(DdNodePtr);
+// offset = (unsigned long) mem & (sizeof(DdNode) - 1);
+// mem += (sizeof(DdNode) - offset) / sizeof(DdNodePtr);
+ offset = (unsigned long) mem & (32 - 1);
+ mem += (32 - offset) / sizeof(DdNodePtr);
#ifdef DD_DEBUG
- assert(((unsigned long) mem & (sizeof(DdNode) - 1)) == 0);
+// assert(((unsigned long) mem & (sizeof(DdNode) - 1)) == 0);
+ assert(((unsigned long) mem & (32 - 1)) == 0);
#endif
list = (DdNode *) mem;
@@ -927,7 +932,7 @@ cuddSwapInPlace(
f1 = cuddT(f);
f0 = cuddE(f);
/* Check xlist for pair (f11,f01). */
- posn = ddHash(f1, f0, xshift);
+ posn = ddHash(cuddF2L(f1), cuddF2L(f0), xshift);
/* For each element tmp in collision list xlist[posn]. */
previousP = &(xlist[posn]);
tmp = *previousP;
@@ -988,7 +993,7 @@ cuddSwapInPlace(
cuddSatInc(newf1->ref);
} else {
/* Check xlist for triple (xindex,f11,f01). */
- posn = ddHash(f11, f01, xshift);
+ posn = ddHash(cuddF2L(f11), cuddF2L(f01), xshift);
/* For each element newf1 in collision list xlist[posn]. */
previousP = &(xlist[posn]);
newf1 = *previousP;
@@ -1042,7 +1047,7 @@ cuddSwapInPlace(
f00 = Cudd_Not(f00);
}
/* Check xlist for triple (xindex,f10,f00). */
- posn = ddHash(f10, f00, xshift);
+ posn = ddHash(cuddF2L(f10), cuddF2L(f00), xshift);
/* For each element newf0 in collision list xlist[posn]. */
previousP = &(xlist[posn]);
newf0 = *previousP;
@@ -1083,7 +1088,7 @@ cuddSwapInPlace(
** The modified f does not already exists in ylist.
** (Because of the uniqueness of the cofactors.)
*/
- posn = ddHash(newf1, newf0, yshift);
+ posn = ddHash(cuddF2L(newf1), cuddF2L(newf0), yshift);
newykeys++;
previousP = &(ylist[posn]);
tmp = *previousP;