summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2013-05-05 09:04:14 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2013-05-05 09:04:14 -0700
commiteacfad762271794965d428cacd1ce56fbc575f93 (patch)
treed4f004b991b412bce177d4637a8322bd26a1f9cd /src
parent7d3301584a82b06e9c6a887e02554bc6a14bec5e (diff)
downloadabc-eacfad762271794965d428cacd1ce56fbc575f93.tar.gz
abc-eacfad762271794965d428cacd1ce56fbc575f93.tar.bz2
abc-eacfad762271794965d428cacd1ce56fbc575f93.zip
Changing the queue to work in the same the array of costs is realloced.
Diffstat (limited to 'src')
-rw-r--r--src/base/abci/abcFx.c10
-rw-r--r--src/map/scl/sclMan.h4
-rw-r--r--src/misc/vec/vecFlt.h4
-rw-r--r--src/misc/vec/vecInt.h4
-rw-r--r--src/misc/vec/vecQue.h10
5 files changed, 16 insertions, 16 deletions
diff --git a/src/base/abci/abcFx.c b/src/base/abci/abcFx.c
index 77a606f1..b337c6ca 100644
--- a/src/base/abci/abcFx.c
+++ b/src/base/abci/abcFx.c
@@ -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 );
diff --git a/src/map/scl/sclMan.h b/src/map/scl/sclMan.h
index 3a2daff7..ebd14d6f 100644
--- a/src/map/scl/sclMan.h
+++ b/src/map/scl/sclMan.h
@@ -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;
}
diff --git a/src/misc/vec/vecFlt.h b/src/misc/vec/vecFlt.h
index 6b4b8f9b..43e34217 100644
--- a/src/misc/vec/vecFlt.h
+++ b/src/misc/vec/vecFlt.h
@@ -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*************************************************************
diff --git a/src/misc/vec/vecInt.h b/src/misc/vec/vecInt.h
index 2fe15792..a99e6f29 100644
--- a/src/misc/vec/vecInt.h
+++ b/src/misc/vec/vecInt.h
@@ -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*************************************************************
diff --git a/src/misc/vec/vecQue.h b/src/misc/vec/vecQue.h
index 445c6fb3..18b8bc10 100644
--- a/src/misc/vec/vecQue.h
+++ b/src/misc/vec/vecQue.h
@@ -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 );