diff options
Diffstat (limited to 'src/sat/xsat/xsatSolver.c')
-rw-r--r-- | src/sat/xsat/xsatSolver.c | 176 |
1 files changed, 83 insertions, 93 deletions
diff --git a/src/sat/xsat/xsatSolver.c b/src/sat/xsat/xsatSolver.c index 5806409e..467f5f8d 100644 --- a/src/sat/xsat/xsatSolver.c +++ b/src/sat/xsat/xsatSolver.c @@ -46,7 +46,7 @@ ABC_NAMESPACE_IMPL_START SeeAlso [] ***********************************************************************/ -static inline int xSAT_SolverDecide( xSAT_Solver_t* s ) +static inline int xSAT_SolverDecide( xSAT_Solver_t * s ) { int NextVar = VarUndef; @@ -74,7 +74,7 @@ static inline int xSAT_SolverDecide( xSAT_Solver_t* s ) SeeAlso [] ***********************************************************************/ -void xSAT_SolverRebuildOrderHeap( xSAT_Solver_t* s ) +void xSAT_SolverRebuildOrderHeap( xSAT_Solver_t * s ) { Vec_Int_t * vTemp = Vec_IntAlloc( Vec_StrSize( s->vAssigns ) ); int Var; @@ -100,14 +100,14 @@ void xSAT_SolverRebuildOrderHeap( xSAT_Solver_t* s ) ***********************************************************************/ static inline void xSAT_SolverVarActRescale( xSAT_Solver_t * s ) { - unsigned * pActivity = (unsigned *) Vec_IntArray( s->vActivity ); int i; + unsigned * pActivity = ( unsigned * ) Vec_IntArray( s->vActivity ); for ( i = 0; i < Vec_IntSize( s->vActivity ); i++ ) pActivity[i] >>= 19; s->nVarActInc >>= 19; - s->nVarActInc = Abc_MaxInt( s->nVarActInc, (1 << 5) ); + s->nVarActInc = Abc_MaxInt( s->nVarActInc, ( 1 << 5 ) ); } /**Function************************************************************* @@ -121,9 +121,9 @@ static inline void xSAT_SolverVarActRescale( xSAT_Solver_t * s ) SeeAlso [] ***********************************************************************/ -static inline void xSAT_SolverVarActBump( xSAT_Solver_t* s, int Var ) +static inline void xSAT_SolverVarActBump( xSAT_Solver_t * s, int Var ) { - unsigned * pActivity = (unsigned *) Vec_IntArray( s->vActivity ); + unsigned * pActivity = ( unsigned * ) Vec_IntArray( s->vActivity ); pActivity[Var] += s->nVarActInc; if ( pActivity[Var] & 0x80000000 ) @@ -167,7 +167,7 @@ static inline void xSAT_SolverClaActRescale( xSAT_Solver_t * s ) Vec_IntForEachEntry( s->vLearnts, CRef, i ) { - pC = xSAT_SolverReadClause( s, (unsigned) CRef ); + pC = xSAT_SolverReadClause( s, ( unsigned ) CRef ); pC->pData[pC->nSize].Act >>= 14; } s->nClaActInc >>= 14; @@ -221,16 +221,16 @@ static inline void xSAT_SolverClaActDecay( xSAT_Solver_t * s ) ***********************************************************************/ static inline int xSAT_SolverClaCalcLBD( xSAT_Solver_t * s, xSAT_Clause_t * pCla ) { - int nLBD = 0; int i; + int nLBD = 0; s->nStamp++; - for ( i = 0; i < (int)pCla->nSize; i++ ) + for ( i = 0; i < pCla->nSize; i++ ) { int Level = Vec_IntEntry( s->vLevels, xSAT_Lit2Var( pCla->pData[i].Lit ) ); - if ( (unsigned) Vec_IntEntry( s->vStamp, Level ) != s->nStamp ) + if ( ( unsigned ) Vec_IntEntry( s->vStamp, Level ) != s->nStamp ) { - Vec_IntWriteEntry( s->vStamp, Level, (int) s->nStamp ); + Vec_IntWriteEntry( s->vStamp, Level, ( int ) s->nStamp ); nLBD++; } } @@ -239,16 +239,16 @@ static inline int xSAT_SolverClaCalcLBD( xSAT_Solver_t * s, xSAT_Clause_t * pCla static inline int xSAT_SolverClaCalcLBD2( xSAT_Solver_t * s, Vec_Int_t * vLits ) { - int nLBD = 0; int i; + int nLBD = 0; s->nStamp++; for ( i = 0; i < Vec_IntSize( vLits ); i++ ) { int Level = Vec_IntEntry( s->vLevels, xSAT_Lit2Var( Vec_IntEntry( vLits, i ) ) ); - if ( (unsigned) Vec_IntEntry( s->vStamp, Level ) != s->nStamp ) + if ( ( unsigned ) Vec_IntEntry( s->vStamp, Level ) != s->nStamp ) { - Vec_IntWriteEntry( s->vStamp, Level, (int) s->nStamp ); + Vec_IntWriteEntry( s->vStamp, Level, ( int ) s->nStamp ); nLBD++; } } @@ -330,13 +330,13 @@ unsigned xSAT_SolverClaNew( xSAT_Solver_t * s, Vec_Int_t * vLits , int fLearnt ) SeeAlso [] ***********************************************************************/ -int xSAT_SolverEnqueue( xSAT_Solver_t* s, int Lit, unsigned Reason ) +int xSAT_SolverEnqueue( xSAT_Solver_t * s, int Lit, unsigned Reason ) { int Var = xSAT_Lit2Var( Lit ); - Vec_StrWriteEntry( s->vAssigns, Var, (char)xSAT_LitSign( Lit ) ); + Vec_StrWriteEntry( s->vAssigns, Var, xSAT_LitSign( Lit ) ); Vec_IntWriteEntry( s->vLevels, Var, xSAT_SolverDecisionLevel( s ) ); - Vec_IntWriteEntry( s->vReasons, Var, (int) Reason ); + Vec_IntWriteEntry( s->vReasons, Var, ( int ) Reason ); Vec_IntPush( s->vTrail, Lit ); return true; @@ -353,7 +353,7 @@ int xSAT_SolverEnqueue( xSAT_Solver_t* s, int Lit, unsigned Reason ) SeeAlso [] ***********************************************************************/ -static inline void xSAT_SolverNewDecision( xSAT_Solver_t* s, int Lit ) +static inline void xSAT_SolverNewDecision( xSAT_Solver_t * s, int Lit ) { assert( Vec_StrEntry( s->vAssigns, xSAT_Lit2Var( Lit ) ) == VarX ); s->Stats.nDecisions++; @@ -375,6 +375,7 @@ static inline void xSAT_SolverNewDecision( xSAT_Solver_t* s, int Lit ) void xSAT_SolverCancelUntil( xSAT_Solver_t * s, int Level ) { int c; + if ( xSAT_SolverDecisionLevel( s ) <= Level ) return; @@ -410,30 +411,30 @@ static int xSAT_SolverIsLitRemovable( xSAT_Solver_t* s, int Lit, int MinLevel ) { int top = Vec_IntSize( s->vTagged ); - assert( (unsigned) Vec_IntEntry( s->vReasons, xSAT_Lit2Var( Lit ) ) != CRefUndef ); + assert( ( unsigned ) Vec_IntEntry( s->vReasons, xSAT_Lit2Var( Lit ) ) != CRefUndef ); Vec_IntClear( s->vStack ); Vec_IntPush( s->vStack, xSAT_Lit2Var( Lit ) ); while ( Vec_IntSize( s->vStack ) ) { + int i; int v = Vec_IntPop( s->vStack ); xSAT_Clause_t* c = xSAT_SolverReadClause(s, ( unsigned ) Vec_IntEntry( s->vReasons, v ) ); - int* Lits = &( c->pData[0].Lit ); - int i; - assert( (unsigned) Vec_IntEntry( s->vReasons, v ) != CRefUndef); + int * Lits = &( c->pData[0].Lit ); + assert( (unsigned) Vec_IntEntry( s->vReasons, v ) != CRefUndef); if( c->nSize == 2 && Vec_StrEntry( s->vAssigns, xSAT_Lit2Var( Lits[0] ) ) == xSAT_LitSign( xSAT_NegLit( Lits[0] ) ) ) { assert( Vec_StrEntry( s->vAssigns, xSAT_Lit2Var( Lits[1] ) ) == xSAT_LitSign( ( Lits[1] ) ) ); ABC_SWAP( int, Lits[0], Lits[1] ); } - for (i = 1; i < (int)c->nSize; i++) + for ( i = 1; i < c->nSize; i++ ) { int v = xSAT_Lit2Var( Lits[i] ); if ( !Vec_StrEntry( s->vSeen, v ) && Vec_IntEntry( s->vLevels, v ) ) { - if ( (unsigned) Vec_IntEntry( s->vReasons, v ) != CRefUndef && ((1 << (Vec_IntEntry( s->vLevels, v ) & 31)) & MinLevel)) + if ( ( unsigned ) Vec_IntEntry( s->vReasons, v ) != CRefUndef && ( ( 1 << (Vec_IntEntry( s->vLevels, v ) & 31 ) ) & MinLevel ) ) { Vec_IntPush( s->vStack, v ); Vec_IntPush( s->vTagged, Lits[i] ); @@ -443,7 +444,7 @@ static int xSAT_SolverIsLitRemovable( xSAT_Solver_t* s, int Lit, int MinLevel ) { int Lit; Vec_IntForEachEntryStart( s->vTagged, Lit, i, top ) - Vec_StrWriteEntry( s->vSeen, xSAT_Lit2Var(Lit), 0 ); + Vec_StrWriteEntry( s->vSeen, xSAT_Lit2Var( Lit ), 0 ); Vec_IntShrink( s->vTagged, top ); return 0; } @@ -479,40 +480,34 @@ static void xSAT_SolverClaMinimisation( xSAT_Solver_t * s, Vec_Int_t * vLits ) /* Remove reduntant literals */ Vec_IntAppend( s->vTagged, vLits ); for ( i = j = 1; i < Vec_IntSize( vLits ); i++ ) - if ( (unsigned) Vec_IntEntry( s->vReasons, xSAT_Lit2Var( pLits[i] ) ) == CRefUndef || !xSAT_SolverIsLitRemovable( s, pLits[i], MinLevel ) ) + if ( ( unsigned ) Vec_IntEntry( s->vReasons, xSAT_Lit2Var( pLits[i] ) ) == CRefUndef || !xSAT_SolverIsLitRemovable( s, pLits[i], MinLevel ) ) pLits[j++] = pLits[i]; Vec_IntShrink( vLits, j ); /* Binary Resolution */ if( Vec_IntSize( vLits ) <= 30 && xSAT_SolverClaCalcLBD2( s, vLits ) <= 6 ) { + int nb, l; int Lit; int FlaseLit = xSAT_NegLit( pLits[0] ); - int nb; - int l; - - xSAT_WatchList_t * ws; - xSAT_Watcher_t * begin; - xSAT_Watcher_t * end; + xSAT_WatchList_t * ws = xSAT_VecWatchListEntry( s->vBinWatches, FlaseLit ); + xSAT_Watcher_t * begin = xSAT_WatchListArray( ws ); + xSAT_Watcher_t * end = begin + xSAT_WatchListSize( ws ); xSAT_Watcher_t * pWatcher; s->nStamp++; Vec_IntForEachEntry( vLits, Lit, i ) - Vec_IntWriteEntry( s->vStamp, xSAT_Lit2Var( Lit ), s->nStamp ); - - ws = xSAT_VecWatchListEntry( s->vBinWatches, FlaseLit ); - begin = xSAT_WatchListArray( ws ); - end = begin + xSAT_WatchListSize( ws ); + Vec_IntWriteEntry( s->vStamp, xSAT_Lit2Var( Lit ), ( int ) s->nStamp ); nb = 0; for ( pWatcher = begin; pWatcher < end; pWatcher++ ) { int ImpLit = pWatcher->Blocker; - if ( Vec_IntEntry( s->vStamp, xSAT_Lit2Var( ImpLit ) ) == (int)s->nStamp && Vec_StrEntry( s->vAssigns, xSAT_Lit2Var( ImpLit ) ) == xSAT_LitSign( ImpLit ) ) + if ( ( unsigned ) Vec_IntEntry( s->vStamp, xSAT_Lit2Var( ImpLit ) ) == s->nStamp && Vec_StrEntry( s->vAssigns, xSAT_Lit2Var( ImpLit ) ) == xSAT_LitSign( ImpLit ) ) { nb++; - Vec_IntWriteEntry( s->vStamp, xSAT_Lit2Var( ImpLit ), s->nStamp - 1 ); + Vec_IntWriteEntry( s->vStamp, xSAT_Lit2Var( ImpLit ), ( int )( s->nStamp - 1 ) ); } } @@ -520,7 +515,7 @@ static void xSAT_SolverClaMinimisation( xSAT_Solver_t * s, Vec_Int_t * vLits ) if ( nb > 0 ) { for ( i = 1; i < Vec_IntSize( vLits ) - nb; i++ ) - if ( Vec_IntEntry( s->vStamp, xSAT_Lit2Var( pLits[i] ) ) != (int)s->nStamp ) + if ( ( unsigned ) Vec_IntEntry( s->vStamp, xSAT_Lit2Var( pLits[i] ) ) != s->nStamp ) { int TempLit = pLits[l]; pLits[l] = pLits[i]; @@ -546,43 +541,44 @@ static void xSAT_SolverClaMinimisation( xSAT_Solver_t * s, Vec_Int_t * vLits ) ***********************************************************************/ static void xSAT_SolverAnalyze( xSAT_Solver_t* s, unsigned ConfCRef, Vec_Int_t * vLearnt, int * OutBtLevel, unsigned * nLBD ) { - int* trail = Vec_IntArray( s->vTrail ); - int Count = 0; + int * trail = Vec_IntArray( s->vTrail ); + int Count = 0; int p = LitUndef; int Idx = Vec_IntSize( s->vTrail ) - 1; - int* Lits; + int * Lits; int Lit; int i, j; Vec_IntPush( vLearnt, LitUndef ); do { - xSAT_Clause_t * c; + xSAT_Clause_t * pCla; + assert( ConfCRef != CRefUndef ); - c = xSAT_SolverReadClause(s, ConfCRef); - Lits = &( c->pData[0].Lit ); + pCla = xSAT_SolverReadClause(s, ConfCRef); + Lits = &( pCla->pData[0].Lit ); - if( p != LitUndef && c->nSize == 2 && Vec_StrEntry( s->vAssigns, xSAT_Lit2Var(Lits[0])) == xSAT_LitSign( xSAT_NegLit( Lits[0] ) ) ) + if( p != LitUndef && pCla->nSize == 2 && Vec_StrEntry( s->vAssigns, xSAT_Lit2Var( Lits[0] ) ) == xSAT_LitSign( xSAT_NegLit( Lits[0] ) ) ) { assert( Vec_StrEntry( s->vAssigns, xSAT_Lit2Var( Lits[1] ) ) == xSAT_LitSign( ( Lits[1] ) ) ); ABC_SWAP( int, Lits[0], Lits[1] ); } - if ( c->fLearnt ) - xSAT_SolverClaActBump( s, c ); + if ( pCla->fLearnt ) + xSAT_SolverClaActBump( s, pCla ); - if ( c->fLearnt && c->nLBD > 2 ) + if ( pCla->fLearnt && pCla->nLBD > 2 ) { - unsigned int nblevels = xSAT_SolverClaCalcLBD(s, c); - if ( nblevels + 1 < c->nLBD ) + unsigned int nLevels = xSAT_SolverClaCalcLBD( s, pCla ); + if ( nLevels + 1 < pCla->nLBD ) { - if (c->nLBD <= s->Config.nLBDFrozenClause) - c->fCanBeDel = 0; - c->nLBD = nblevels; + if ( pCla->nLBD <= s->Config.nLBDFrozenClause ) + pCla->fCanBeDel = 0; + pCla->nLBD = nLevels; } } - for ( j = ( p == LitUndef ? 0 : 1 ); j < (int)c->nSize; j++ ) + for ( j = ( p == LitUndef ? 0 : 1 ); j < pCla->nSize; j++ ) { int Var = xSAT_Lit2Var( Lits[j] ); @@ -605,14 +601,13 @@ static void xSAT_SolverAnalyze( xSAT_Solver_t* s, unsigned ConfCRef, Vec_Int_t * // Next clause to look at p = trail[Idx+1]; - ConfCRef = (unsigned) Vec_IntEntry( s->vReasons, xSAT_Lit2Var( p ) ); + ConfCRef = ( unsigned ) Vec_IntEntry( s->vReasons, xSAT_Lit2Var( p ) ); Vec_StrWriteEntry( s->vSeen, xSAT_Lit2Var( p ), 0 ); Count--; } while ( Count > 0 ); Vec_IntArray( vLearnt )[0] = xSAT_NegLit( p ); - xSAT_SolverClaMinimisation( s, vLearnt ); // Find the backtrack level @@ -677,41 +672,38 @@ unsigned xSAT_SolverPropagate( xSAT_Solver_t* s ) while ( s->iQhead < Vec_IntSize( s->vTrail ) ) { int p = Vec_IntEntry( s->vTrail, s->iQhead++ ); - xSAT_WatchList_t* ws = xSAT_VecWatchListEntry( s->vBinWatches, p ); xSAT_Watcher_t* begin = xSAT_WatchListArray( ws ); xSAT_Watcher_t* end = begin + xSAT_WatchListSize( ws ); xSAT_Watcher_t *i, *j; nProp++; - for (i = begin; i < end; i++) + for ( i = begin; i < end; i++ ) { - if ( Vec_StrEntry( s->vAssigns, xSAT_Lit2Var(i->Blocker)) == xSAT_LitSign(xSAT_NegLit(i->Blocker))) + if ( Vec_StrEntry( s->vAssigns, xSAT_Lit2Var( i->Blocker ) ) == xSAT_LitSign( xSAT_NegLit( i->Blocker ) ) ) { return i->CRef; } - else if ( Vec_StrEntry( s->vAssigns, xSAT_Lit2Var(i->Blocker)) == VarX) - xSAT_SolverEnqueue(s, i->Blocker, i->CRef); + else if ( Vec_StrEntry( s->vAssigns, xSAT_Lit2Var( i->Blocker ) ) == VarX ) + xSAT_SolverEnqueue( s, i->Blocker, i->CRef ); } - - ws = xSAT_VecWatchListEntry( s->vWatches, p); + ws = xSAT_VecWatchListEntry( s->vWatches, p ); begin = xSAT_WatchListArray( ws ); end = begin + xSAT_WatchListSize( ws ); for ( i = j = begin; i < end; ) { - xSAT_Clause_t* c; + xSAT_Clause_t * pCla; xSAT_Watcher_t w; - if ( Vec_StrEntry( s->vAssigns, xSAT_Lit2Var( i->Blocker ) ) == xSAT_LitSign( i->Blocker ) ) { *j++ = *i++; continue; } - c = xSAT_SolverReadClause( s, i->CRef ); - Lits = &( c->pData[0].Lit ); + pCla = xSAT_SolverReadClause( s, i->CRef ); + Lits = &( pCla->pData[0].Lit ); // Make sure the false literal is data[1]: NegLit = xSAT_NegLit( p ); @@ -731,8 +723,8 @@ unsigned xSAT_SolverPropagate( xSAT_Solver_t* s ) else { // Look for new watch: - int* stop = Lits + c->nSize; - int* k; + int * stop = Lits + pCla->nSize; + int * k; for ( k = Lits + 2; k < stop; k++ ) { if (Vec_StrEntry( s->vAssigns, xSAT_Lit2Var( *k ) ) != !xSAT_LitSign( *k ) ) @@ -791,7 +783,7 @@ void xSAT_SolverReduceDB( xSAT_Solver_t * s ) int nLearnedOld = Vec_IntSize( s->vLearnts ); int i, limit; unsigned CRef; - xSAT_Clause_t * c; + xSAT_Clause_t * pCla; xSAT_Clause_t ** learnts_cls; learnts_cls = ABC_ALLOC( xSAT_Clause_t *, nLearnedOld ); @@ -812,21 +804,22 @@ void xSAT_SolverReduceDB( xSAT_Solver_t * s ) for ( i = 0; i < nLearnedOld; i++ ) { unsigned CRef; - c = learnts_cls[i]; - CRef = xSAT_MemCRef( s->pMemory, (unsigned * ) c ); - assert(c->fMark == 0); - if ( c->fCanBeDel && c->nLBD > 2 && c->nSize > 2 && (unsigned) Vec_IntEntry( s->vReasons, xSAT_Lit2Var( c->pData[0].Lit ) ) != CRef && ( i < limit ) ) + + pCla = learnts_cls[i]; + CRef = xSAT_MemCRef( s->pMemory, ( unsigned * ) pCla ); + assert( pCla->fMark == 0 ); + if ( pCla->fCanBeDel && pCla->nLBD > 2 && pCla->nSize > 2 && (unsigned) Vec_IntEntry( s->vReasons, xSAT_Lit2Var( pCla->pData[0].Lit ) ) != CRef && ( i < limit ) ) { - c->fMark = 1; - s->Stats.nLearntLits -= c->nSize; - xSAT_WatchListRemove( xSAT_VecWatchListEntry( s->vWatches, xSAT_NegLit( c->pData[0].Lit ) ), CRef ); - xSAT_WatchListRemove( xSAT_VecWatchListEntry( s->vWatches, xSAT_NegLit( c->pData[1].Lit ) ), CRef ); + pCla->fMark = 1; + s->Stats.nLearntLits -= pCla->nSize; + xSAT_WatchListRemove( xSAT_VecWatchListEntry( s->vWatches, xSAT_NegLit( pCla->pData[0].Lit ) ), CRef ); + xSAT_WatchListRemove( xSAT_VecWatchListEntry( s->vWatches, xSAT_NegLit( pCla->pData[1].Lit ) ), CRef ); } else { - if (!c->fCanBeDel) + if ( !pCla->fCanBeDel ) limit++; - c->fCanBeDel = 1; + pCla->fCanBeDel = 1; Vec_IntPush( s->vLearnts, CRef ); } } @@ -876,7 +869,7 @@ char xSAT_SolverSearch( xSAT_Solver_t * s ) return LBoolFalse; xSAT_BQueuePush( s->bqTrail, Vec_IntSize( s->vTrail ) ); - if ( s->Stats.nConflicts > s->Config.nFirstBlockRestart && xSAT_BQueueIsValid( s->bqLBD ) && ( Vec_IntSize( s->vTrail ) > ( s->Config.R * (iword)xSAT_BQueueAvg( s->bqTrail ) ) ) ) + if ( s->Stats.nConflicts > s->Config.nFirstBlockRestart && xSAT_BQueueIsValid( s->bqLBD ) && ( Vec_IntSize( s->vTrail ) > ( s->Config.R * ( iword ) xSAT_BQueueAvg( s->bqTrail ) ) ) ) xSAT_BQueueClean(s->bqLBD); Vec_IntClear( s->vLearntClause ); @@ -896,7 +889,7 @@ char xSAT_SolverSearch( xSAT_Solver_t * s ) { /* No conflict */ int NextVar; - if ( xSAT_BQueueIsValid( s->bqLBD ) && ( ( (iword)xSAT_BQueueAvg( s->bqLBD ) * s->Config.K ) > ( s->nSumLBD / (iword)s->Stats.nConflicts ) ) ) + if ( xSAT_BQueueIsValid( s->bqLBD ) && ( ( ( iword )xSAT_BQueueAvg( s->bqLBD ) * s->Config.K ) > ( s->nSumLBD / s->Stats.nConflicts ) ) ) { xSAT_BQueueClean( s->bqLBD ); xSAT_SolverCancelUntil( s, 0 ); @@ -942,23 +935,20 @@ char xSAT_SolverSearch( xSAT_Solver_t * s ) ***********************************************************************/ void xSAT_SolverClaRealloc( xSAT_Mem_t * pDest, xSAT_Mem_t * pSrc, unsigned * pCRef ) { - xSAT_Clause_t * pOldCla = xSAT_MemClauseHand( pSrc, *pCRef ); unsigned nNewCRef; xSAT_Clause_t * pNewCla; + xSAT_Clause_t * pOldCla = xSAT_MemClauseHand( pSrc, *pCRef ); if ( pOldCla->fReallocd ) { - *pCRef = (unsigned) pOldCla->nSize; + *pCRef = ( unsigned ) pOldCla->nSize; return; } - nNewCRef = xSAT_MemAppend( pDest, 3 + pOldCla->fLearnt + pOldCla->nSize ); pNewCla = xSAT_MemClauseHand( pDest, nNewCRef ); - memcpy( pNewCla, pOldCla, ( 3 + pOldCla->fLearnt + pOldCla->nSize ) * 4 ); - pOldCla->fReallocd = 1; - pOldCla->nSize = (unsigned) nNewCRef; + pOldCla->nSize = ( unsigned ) nNewCRef; *pCRef = nNewCRef; } @@ -997,14 +987,14 @@ void xSAT_SolverGarbageCollect( xSAT_Solver_t * s ) } for ( i = 0; i < Vec_IntSize( s->vTrail ); i++ ) - if ( (unsigned) Vec_IntEntry( s->vReasons, xSAT_Lit2Var( Vec_IntEntry( s->vTrail, i ) ) ) != CRefUndef ) - xSAT_SolverClaRealloc( pNewMemMngr, s->pMemory, (unsigned *)&( Vec_IntArray( s->vReasons )[xSAT_Lit2Var( Vec_IntEntry( s->vTrail, i ) )] ) ); + if ( ( unsigned ) Vec_IntEntry( s->vReasons, xSAT_Lit2Var( Vec_IntEntry( s->vTrail, i ) ) ) != CRefUndef ) + xSAT_SolverClaRealloc( pNewMemMngr, s->pMemory, ( unsigned * ) &( Vec_IntArray( s->vReasons )[xSAT_Lit2Var( Vec_IntEntry( s->vTrail, i ) )] ) ); pArray = ( unsigned * ) Vec_IntArray( s->vLearnts ); for ( i = 0; i < Vec_IntSize( s->vLearnts ); i++ ) xSAT_SolverClaRealloc( pNewMemMngr, s->pMemory, &(pArray[i]) ); - pArray = (unsigned *) Vec_IntArray( s->vClauses ); + pArray = ( unsigned * ) Vec_IntArray( s->vClauses ); for ( i = 0; i < Vec_IntSize( s->vClauses ); i++ ) xSAT_SolverClaRealloc( pNewMemMngr, s->pMemory, &(pArray[i]) ); |