abc/src/bool/lucky/lucky.c
// swaps iVar and iVar+1 elements in pCanonPerm ant p_uCanonPhase
swaps iVar and iVar+1 elements in pCanonPerm ant p_uCanonPhase
swaps iVar and iVar + 1 elements in pCanonPerm ant p_uCanonPhase
void swapInfoAdjacentVars(int iVar, char * pCanonPerm, unsigned* p_uCanonPhase)
{
    char Temp = pCanonPerm[iVar];
    pCanonPerm[iVar] = pCanonPerm[iVar+1];
    pCanonPerm[iVar+1] = Temp;
    if ( ((*p_uCanonPhase & (1 << iVar)) > 0) != ((*p_uCanonPhase & (1 << (iVar+1))) > 0) )
    {
        *p_uCanonPhase ^= (1 << iVar);
        *p_uCanonPhase ^= (1 << (iVar+1));
    }
}
void swapInfoAdjacentVars ( int iVar , char * pCanonPerm , unsigned * p_uCanonPhase ) { char Temp = pCanonPerm [ iVar ] ; pCanonPerm [ iVar ] = pCanonPerm [ iVar + 1 ] ; pCanonPerm [ iVar + 1 ] = Temp ; if ( ( ( * p_uCanonPhase & ( 1 << iVar ) ) > 0 ) != ( ( * p_uCanonPhase & ( 1 << ( iVar + 1 ) ) ) > 0 ) ) { * p_uCanonPhase ^= ( 1 << iVar ) ; * p_uCanonPhase ^= ( 1 << ( iVar + 1 ) ) ; } }
swaps iVar and iVar+1 elements in pCanonPerm ant p_uCanonPhase
swaps iVar and iVar + 1 elements in pCanonPerm ant p_uCanonPhase
// if the polarity of variables is different, swap them