summaryrefslogtreecommitdiffstats
path: root/src/bool
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2012-09-06 21:44:56 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2012-09-06 21:44:56 -0700
commit894fc810414ea0e06f8ed504a89a8844c3cc129a (patch)
tree351b887ee4425df3b858d12e82ee3327f7a943d5 /src/bool
parent4efd8bf7b30c89163bb13ad6958e7f3ee9cd15d5 (diff)
downloadabc-894fc810414ea0e06f8ed504a89a8844c3cc129a.tar.gz
abc-894fc810414ea0e06f8ed504a89a8844c3cc129a.tar.bz2
abc-894fc810414ea0e06f8ed504a89a8844c3cc129a.zip
Debugging 64-bit bug in new semi-canonical form..
Diffstat (limited to 'src/bool')
-rw-r--r--src/bool/lucky/luckyFast16.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/bool/lucky/luckyFast16.c b/src/bool/lucky/luckyFast16.c
index 886aa249..c9cddd5a 100644
--- a/src/bool/lucky/luckyFast16.c
+++ b/src/bool/lucky/luckyFast16.c
@@ -27,6 +27,7 @@ static word SFmask[5][4] = {
{0xFFFF000000000000,0x0000FFFF00000000,0x00000000FFFF0000,0x000000000000FFFF}
};
+static inline word luckyMask(int nBits) { assert(nBits >= 0 && nBits <= 64); return nBits == 64 ? 0 : (~(word)0) >> (64-nBits); }
////////////////////////////////////lessThen5/////////////////////////////////////////////////////////////////////////////////////////////
@@ -69,9 +70,7 @@ inline int minTemp0_fast(word* pInOut, int iVar, int nWords, int* pDifStart)
else
{
*pDifStart = i*100;
- assert( shiftSize >= 0 && shiftSize <= 64 );
- if ( shiftSize < 64 )
- while(temp == (temp<<(shiftSize*j))>>shiftSize*j)
+ while(temp == (temp & luckyMask(shiftSize*j)))
j++;
*pDifStart += 21 - j;
@@ -102,9 +101,7 @@ inline int minTemp1_fast(word* pInOut, int iVar, int nWords, int* pDifStart)
else
{
*pDifStart = i*100;
- assert( shiftSize >= 0 && shiftSize <= 64 );
- if ( shiftSize < 64 )
- while(temp == (temp<<(shiftSize*j))>>shiftSize*j)
+ while(temp == (temp & luckyMask(shiftSize*j)))
j++;
*pDifStart += 21 - j;
if( ((pInOut[i] & SFmask[iVar][1])<<(blockSize)) < ((pInOut[i] & SFmask[iVar][2])<<(2*blockSize)) )
@@ -135,9 +132,7 @@ inline int minTemp2_fast(word* pInOut, int iVar, int iQ, int jQ, int nWords, int
else
{
*pDifStart = i*100;
- assert( shiftSize >= 0 && shiftSize <= 64 );
- if ( shiftSize < 64 )
- while(temp == (temp<<(shiftSize*j))>>shiftSize*j)
+ while(temp == (temp & luckyMask(shiftSize*j)))
j++;
*pDifStart += 21 - j;
if( ((pInOut[i] & SFmask[iVar][iQ])<<(iQ*blockSize)) <= ((pInOut[i] & SFmask[iVar][jQ])<<(jQ*blockSize)) )
@@ -164,9 +159,7 @@ inline int minTemp3_fast(word* pInOut, int iVar, int start, int finish, int iQ,
else
{
*pDifStart = i*100;
- assert( shiftSize >= 0 && shiftSize <= 64 );
- if ( shiftSize < 64 )
- while(temp == (temp<<(shiftSize*j))>>shiftSize*j)
+ while(temp == (temp & luckyMask(shiftSize*j)))
j++;
*pDifStart += 21 - j;