From 894fc810414ea0e06f8ed504a89a8844c3cc129a Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Thu, 6 Sep 2012 21:44:56 -0700 Subject: Debugging 64-bit bug in new semi-canonical form.. --- src/bool/lucky/luckyFast16.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'src/bool') 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; -- cgit v1.2.3