diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2013-05-05 01:54:11 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2013-05-05 01:54:11 -0700 |
commit | a762c695d7c0d953d644c0c77a2948d378d0d624 (patch) | |
tree | cd4fc1dc5462af045e0a87ba472de15fb7e00f1f /src/misc/vec/vecQue.h | |
parent | 7f700af6e2fff06e2cf855b4a3845eadcf66086b (diff) | |
download | abc-a762c695d7c0d953d644c0c77a2948d378d0d624.tar.gz abc-a762c695d7c0d953d644c0c77a2948d378d0d624.tar.bz2 abc-a762c695d7c0d953d644c0c77a2948d378d0d624.zip |
New fast extract.
Diffstat (limited to 'src/misc/vec/vecQue.h')
-rw-r--r-- | src/misc/vec/vecQue.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/misc/vec/vecQue.h b/src/misc/vec/vecQue.h index 83be97a8..445c6fb3 100644 --- a/src/misc/vec/vecQue.h +++ b/src/misc/vec/vecQue.h @@ -94,7 +94,7 @@ static inline void Vec_QueFreeP( Vec_Que_t ** p ) } 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 ) @@ -215,12 +215,15 @@ static inline void Vec_QueUpdate( Vec_Que_t * p, int v ) ***********************************************************************/ static inline int Vec_QueIsMember( Vec_Que_t * p, int v ) { - return (int)( p->pOrder[v] >= 0 ); + assert( v >= 0 ); + return (int)( v < p->nCap && p->pOrder[v] >= 0 ); } static inline void Vec_QuePush( Vec_Que_t * p, int v ) { - if ( p->nSize == p->nCap ) - Vec_QueGrow( p, 2 * p->nCap ); + if ( p->nSize >= p->nCap ) + Vec_QueGrow( p, Abc_MaxInt(p->nSize+1, 2*p->nCap) ); + if ( v >= p->nCap ) + Vec_QueGrow( p, Abc_MaxInt(v+1, 2*p->nCap) ); assert( p->nSize < p->nCap ); assert( p->pOrder[v] == -1 ); assert( p->pHeap[p->nSize] == -1 ); |