Commit eacfad76 by Alan Mishchenko

Changing the queue to work in the same the array of costs is realloced.

parent 7d330158
......@@ -51,6 +51,7 @@ BSC32=bscmake.exe
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib lib\abcr.lib lib\x86\pthreadVC2.lib /nologo /subsystem:console /incremental:yes /debug /machine:I386 /out:"_TEST/abc.exe"
# SUBTRACT LINK32 /profile
!ELSEIF "$(CFG)" == "abcexe - Win32 Debug"
......
......@@ -636,10 +636,7 @@ int Fx_ManCubeSingleCubeDivisors( Fx_Man_t * p, Vec_Int_t * vPivot, int fRemove,
{
if ( Vec_FltSize(p->vWeights) == iDiv )
{
float * pArray = Vec_FltArray(p->vWeights);
Vec_FltPush(p->vWeights, -2);
if ( p->vPrio && pArray != Vec_FltArray(p->vWeights) )
Vec_QueSetCosts( p->vPrio, Vec_FltArray(p->vWeights) );
p->nDivsS++;
}
assert( iDiv < Vec_FltSize(p->vWeights) );
......@@ -692,12 +689,7 @@ void Fx_ManCubeDoubleCubeDivisors( Fx_Man_t * p, int iFirst, Vec_Int_t * vPivot,
if ( !fRemove )
{
if ( iDiv == Vec_FltSize(p->vWeights) )
{
float * pArray = Vec_FltArray(p->vWeights);
Vec_FltPush(p->vWeights, -Vec_IntSize(p->vFree));
if ( p->vPrio && pArray != Vec_FltArray(p->vWeights) )
Vec_QueSetCosts( p->vPrio, Vec_FltArray(p->vWeights) );
}
assert( iDiv < Vec_FltSize(p->vWeights) );
Vec_FltAddToEntry( p->vWeights, iDiv, Base + Vec_IntSize(p->vFree) - 1 );
p->nPairsD++;
......@@ -735,7 +727,7 @@ void Fx_ManCreateDivisors( Fx_Man_t * p )
Fx_ManCubeDoubleCubeDivisors( p, i+1, vCube, 0, 0 ); // add - no update
// create queue with all divisors
p->vPrio = Vec_QueAlloc( Vec_FltSize(p->vWeights) );
Vec_QueSetCosts( p->vPrio, Vec_FltArray(p->vWeights) );
Vec_QueSetCosts( p->vPrio, Vec_FltArrayP(p->vWeights) );
Vec_FltForEachEntry( p->vWeights, Weight, i )
if ( Weight > 0.0 )
Vec_QuePush( p->vPrio, i );
......
......@@ -152,7 +152,7 @@ static inline SC_Man * Abc_SclManAlloc( SC_Lib * pLib, Abc_Ntk_t * pNtk )
p->pSlack = ABC_FALLOC( float, p->nObjs );
p->vTimesOut = Vec_FltStart( Abc_NtkCoNum(pNtk) );
p->vQue = Vec_QueAlloc( Abc_NtkCoNum(pNtk) );
Vec_QueSetCosts( p->vQue, Vec_FltArray(p->vTimesOut) );
Vec_QueSetCosts( p->vQue, Vec_FltArrayP(p->vTimesOut) );
for ( i = 0; i < Abc_NtkCoNum(pNtk); i++ )
Vec_QuePush( p->vQue, i );
p->vUpdates = Vec_IntAlloc( 1000 );
......@@ -160,7 +160,7 @@ static inline SC_Man * Abc_SclManAlloc( SC_Lib * pLib, Abc_Ntk_t * pNtk )
p->vNode2Gain = Vec_FltStart( p->nObjs );
p->vNode2Gate = Vec_IntStart( p->nObjs );
p->vNodeByGain = Vec_QueAlloc( p->nObjs );
Vec_QueSetCosts( p->vNodeByGain, Vec_FltArray(p->vNode2Gain) );
Vec_QueSetCosts( p->vNodeByGain, Vec_FltArrayP(p->vNode2Gain) );
p->vNodeIter = Vec_IntStartFull( p->nObjs );
return p;
}
......
......@@ -267,6 +267,10 @@ static inline float * Vec_FltArray( Vec_Flt_t * p )
{
return p->pArray;
}
static inline float ** Vec_FltArrayP( Vec_Flt_t * p )
{
return &p->pArray;
}
/**Function*************************************************************
......
......@@ -321,6 +321,10 @@ static inline int * Vec_IntArray( Vec_Int_t * p )
{
return p->pArray;
}
static inline int ** Vec_IntArrayP( Vec_Int_t * p )
{
return &p->pArray;
}
/**Function*************************************************************
......
......@@ -44,10 +44,10 @@ struct Vec_Que_t_
int nSize;
int * pHeap;
int * pOrder;
float * pCostsFlt; // owned by the caller
float ** pCostsFlt; // owned by the caller
};
static inline float Vec_QueCost( Vec_Que_t * p, int v ) { return p->pCostsFlt ? p->pCostsFlt[v] : v; }
static inline float Vec_QueCost( Vec_Que_t * p, int v ) { return *p->pCostsFlt ? (*p->pCostsFlt)[v] : v; }
////////////////////////////////////////////////////////////////////////
/// MACRO DEFINITIONS ///
......@@ -92,9 +92,9 @@ static inline void Vec_QueFreeP( Vec_Que_t ** p )
Vec_QueFree( *p );
*p = NULL;
}
static inline void Vec_QueSetCosts( Vec_Que_t * p, float * pCosts )
static inline void Vec_QueSetCosts( Vec_Que_t * p, float ** pCosts )
{
// assert( p->pCostsFlt == NULL );
assert( p->pCostsFlt == NULL );
p->pCostsFlt = pCosts;
}
static inline void Vec_QueGrow( Vec_Que_t * p, int nCapMin )
......@@ -333,7 +333,7 @@ static inline void Vec_QueTest( Vec_Flt_t * vCosts )
// start the queue
p = Vec_QueAlloc( Vec_FltSize(vCosts) );
Vec_QueSetCosts( p, Vec_FltArray(vCosts) );
Vec_QueSetCosts( p, Vec_FltArrayP(vCosts) );
for ( i = 0; i < Vec_FltSize(vCosts); i++ )
Vec_QuePush( p, i );
// Vec_QuePrint( p );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment