diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2013-05-12 19:09:28 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2013-05-12 19:09:28 -0700 |
commit | 9d219eee4b8901d18b0c471205b1cec9fb1f0d1b (patch) | |
tree | 3be5e49e749d9c0cd4337d213ecb6221bc4876cc /src/misc/vec | |
parent | 7bcd75d80afd44633d018fc9636bf3788709bae2 (diff) | |
download | abc-9d219eee4b8901d18b0c471205b1cec9fb1f0d1b.tar.gz abc-9d219eee4b8901d18b0c471205b1cec9fb1f0d1b.tar.bz2 abc-9d219eee4b8901d18b0c471205b1cec9fb1f0d1b.zip |
New MFS package.
Diffstat (limited to 'src/misc/vec')
-rw-r--r-- | src/misc/vec/vecInt.h | 6 | ||||
-rw-r--r-- | src/misc/vec/vecWec.h | 8 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/misc/vec/vecInt.h b/src/misc/vec/vecInt.h index a99e6f29..c821d121 100644 --- a/src/misc/vec/vecInt.h +++ b/src/misc/vec/vecInt.h @@ -255,6 +255,12 @@ static inline Vec_Int_t * Vec_IntDupArray( Vec_Int_t * pVec ) SeeAlso [] ***********************************************************************/ +static inline void Vec_IntZero( Vec_Int_t * p ) +{ + p->pArray = NULL; + p->nSize = 0; + p->nCap = 0; +} static inline void Vec_IntErase( Vec_Int_t * p ) { ABC_FREE( p->pArray ); diff --git a/src/misc/vec/vecWec.h b/src/misc/vec/vecWec.h index 8a924f90..ece7b0a1 100644 --- a/src/misc/vec/vecWec.h +++ b/src/misc/vec/vecWec.h @@ -245,6 +245,7 @@ static inline void Vec_WecClear( Vec_Wec_t * p ) int i; Vec_WecForEachLevel( p, vVec, i ) Vec_IntClear( vVec ); + p->nSize = 0; } /**Function************************************************************* @@ -315,10 +316,9 @@ static inline double Vec_WecMemory( Vec_Wec_t * p ) ***********************************************************************/ static inline void Vec_WecFree( Vec_Wec_t * p ) { - Vec_Int_t * vVec; int i; - Vec_WecForEachLevel( p, vVec, i ) - ABC_FREE( vVec->pArray ); + for ( i = 0; i < p->nCap; i++ ) + ABC_FREE( p->pArray[i].pArray ); ABC_FREE( p->pArray ); ABC_FREE( p ); } @@ -643,6 +643,8 @@ static inline void Vec_WecRemoveEmpty( Vec_Wec_t * vCubes ) vCubes->pArray[k++] = *vCube; else ABC_FREE( vCube->pArray ); + for ( i = k; i < Vec_WecSize(vCubes); i++ ) + Vec_IntZero( Vec_WecEntry(vCubes, i) ); Vec_WecShrink( vCubes, k ); // Vec_WecSortByFirstInt( vCubes, 0 ); } |