summaryrefslogtreecommitdiffstats
path: root/src/map/if/ifCut.c
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2008-04-11 08:01:00 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2008-04-11 08:01:00 -0700
commit651a32cdc379d2341c631b719ed9af16ce5a66c9 (patch)
tree9c4ffb213ac4a958db8134e21c5e83bafe48005b /src/map/if/ifCut.c
parentc645bac3663c265470024b44ed91b0afdbe59b88 (diff)
downloadabc-651a32cdc379d2341c631b719ed9af16ce5a66c9.tar.gz
abc-651a32cdc379d2341c631b719ed9af16ce5a66c9.tar.bz2
abc-651a32cdc379d2341c631b719ed9af16ce5a66c9.zip
Version abc80411
Diffstat (limited to 'src/map/if/ifCut.c')
-rw-r--r--src/map/if/ifCut.c60
1 files changed, 59 insertions, 1 deletions
diff --git a/src/map/if/ifCut.c b/src/map/if/ifCut.c
index 08653d95..afaae239 100644
--- a/src/map/if/ifCut.c
+++ b/src/map/if/ifCut.c
@@ -297,6 +297,7 @@ int If_CutMerge( If_Cut_t * pCut0, If_Cut_t * pCut1, If_Cut_t * pCut )
return 0;
}
pCut->uSign = pCut0->uSign | pCut1->uSign;
+ assert( If_CutCheck( pCut ) );
return 1;
}
@@ -605,6 +606,63 @@ void If_CutSort( If_Man_t * p, If_Set_t * pCutSet, If_Cut_t * pCut )
/**Function*************************************************************
+ Synopsis [Orders the leaves of the cut.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+void If_CutOrder( If_Cut_t * pCut )
+{
+ int i, Temp, fChanges;
+ do {
+ fChanges = 0;
+ for ( i = 0; i < (int)pCut->nLeaves - 1; i++ )
+ {
+ assert( pCut->pLeaves[i] != pCut->pLeaves[i+1] );
+ if ( pCut->pLeaves[i] <= pCut->pLeaves[i+1] )
+ continue;
+ Temp = pCut->pLeaves[i];
+ pCut->pLeaves[i] = pCut->pLeaves[i+1];
+ pCut->pLeaves[i+1] = Temp;
+ fChanges = 1;
+ }
+ } while ( fChanges );
+}
+
+/**Function*************************************************************
+
+ Synopsis [Checks correctness of the cut.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+int If_CutCheck( If_Cut_t * pCut )
+{
+ int i;
+ assert( pCut->nLeaves <= pCut->nLimit );
+ for ( i = 1; i < (int)pCut->nLeaves; i++ )
+ {
+ if ( pCut->pLeaves[i-1] >= pCut->pLeaves[i] )
+ {
+ printf( "If_CutCheck(): Cut has wrong ordering of inputs.\n" );
+ return 0;
+ }
+ assert( pCut->pLeaves[i-1] < pCut->pLeaves[i] );
+ }
+ return 1;
+}
+
+
+/**Function*************************************************************
+
Synopsis [Prints one cut.]
Description []
@@ -614,7 +672,7 @@ void If_CutSort( If_Man_t * p, If_Set_t * pCutSet, If_Cut_t * pCut )
SeeAlso []
***********************************************************************/
-void If_CutPrint( If_Man_t * p, If_Cut_t * pCut )
+void If_CutPrint( If_Cut_t * pCut )
{
unsigned i;
printf( "{" );