summaryrefslogtreecommitdiffstats
path: root/src/bool/lucky/luckySwap.c
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2012-09-25 13:10:52 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2012-09-25 13:10:52 -0700
commit0a9236add5e4c4f81dfff79f0ec24fc7d69cf323 (patch)
treebfc10780aa3f30e9692e91448796074f2238d16a /src/bool/lucky/luckySwap.c
parentaed3b3a13acf9113cc4ec254933efce6114519be (diff)
downloadabc-0a9236add5e4c4f81dfff79f0ec24fc7d69cf323.tar.gz
abc-0a9236add5e4c4f81dfff79f0ec24fc7d69cf323.tar.bz2
abc-0a9236add5e4c4f81dfff79f0ec24fc7d69cf323.zip
Improvements to the NPN semi-canonical form computation package.
Diffstat (limited to 'src/bool/lucky/luckySwap.c')
-rw-r--r--src/bool/lucky/luckySwap.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/bool/lucky/luckySwap.c b/src/bool/lucky/luckySwap.c
index 13bb489e..e4065db6 100644
--- a/src/bool/lucky/luckySwap.c
+++ b/src/bool/lucky/luckySwap.c
@@ -241,6 +241,7 @@ inline unsigned Kit_TruthSemiCanonicize_Yasha( word* pInOut, int nVars, char *
} while ( fChange );
return uCanonPhase;
}
+
inline unsigned Kit_TruthSemiCanonicize_Yasha1( word* pInOut, int nVars, char * pCanonPerm, int * pStore )
{
int nWords = Kit_TruthWordNum_64bit( nVars );
@@ -250,8 +251,8 @@ inline unsigned Kit_TruthSemiCanonicize_Yasha1( word* pInOut, int nVars, char *
assert( nVars <= 16 );
nOnes = Kit_TruthCountOnes_64bit(pInOut, nVars);
- // if ( (nOnes == nWords * 32) )
- // return 999999;
+ if ( nOnes == nWords * 32 )
+ uCanonPhase |= (1 << (nVars+2));
if ( (nOnes > nWords * 32) )
{
@@ -266,9 +267,12 @@ inline unsigned Kit_TruthSemiCanonicize_Yasha1( word* pInOut, int nVars, char *
// canonicize phase
for ( i = 0; i < nVars; i++ )
{
- // if ( pStore[i] == nOnes-pStore[i])
- // return 999999;
- if ( pStore[i] >= nOnes-pStore[i])
+ if ( 2*pStore[i] == nOnes)
+ {
+ uCanonPhase |= (1 << (nVars+1));
+ continue;
+ }
+ if ( pStore[i] > nOnes-pStore[i])
continue;
uCanonPhase |= (1 << i);
pStore[i] = nOnes-pStore[i];