diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2005-11-26 08:01:00 -0800 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2005-11-26 08:01:00 -0800 |
commit | e3c40ed61ee3febefb002d3b929f157ccdffca81 (patch) | |
tree | db596ea13b4be6ae31617fad2cb3463190f99c90 /src/misc | |
parent | 08d2b31046bfccdfe1239344eb5114ea01301f06 (diff) | |
download | abc-e3c40ed61ee3febefb002d3b929f157ccdffca81.tar.gz abc-e3c40ed61ee3febefb002d3b929f157ccdffca81.tar.bz2 abc-e3c40ed61ee3febefb002d3b929f157ccdffca81.zip |
Version abc51126
Diffstat (limited to 'src/misc')
-rw-r--r-- | src/misc/vec/vec.h | 1 | ||||
-rw-r--r-- | src/misc/vec/vecFan_.h (renamed from src/misc/vec/vecFan.h) | 0 | ||||
-rw-r--r-- | src/misc/vec/vecInt.h | 60 |
3 files changed, 59 insertions, 2 deletions
diff --git a/src/misc/vec/vec.h b/src/misc/vec/vec.h index 4f81a004..f5ecf9bd 100644 --- a/src/misc/vec/vec.h +++ b/src/misc/vec/vec.h @@ -29,7 +29,6 @@ #define inline __inline // compatible with MS VS 6.0 #endif -#include "vecFan.h" #include "vecInt.h" #include "vecStr.h" #include "vecPtr.h" diff --git a/src/misc/vec/vecFan.h b/src/misc/vec/vecFan_.h index 1493014a..1493014a 100644 --- a/src/misc/vec/vecFan.h +++ b/src/misc/vec/vecFan_.h diff --git a/src/misc/vec/vecInt.h b/src/misc/vec/vecInt.h index 3c767f20..2d36addd 100644 --- a/src/misc/vec/vecInt.h +++ b/src/misc/vec/vecInt.h @@ -457,6 +457,41 @@ static inline void Vec_IntPush( Vec_Int_t * p, int Entry ) SeeAlso [] ***********************************************************************/ +static inline void Vec_IntPushMem( Extra_MmStep_t * pMemMan, Vec_Int_t * p, int Entry ) +{ + if ( p->nSize == p->nCap ) + { + int * pArray; + int i; + + if ( p->nSize == 0 ) + p->nCap = 1; + pArray = (int *)Extra_MmStepEntryFetch( pMemMan, p->nCap * 8 ); +// pArray = ALLOC( int, p->nCap * 2 ); + if ( p->pArray ) + { + for ( i = 0; i < p->nSize; i++ ) + pArray[i] = p->pArray[i]; + Extra_MmStepEntryRecycle( pMemMan, (char *)p->pArray, p->nCap * 4 ); +// free( p->pArray ); + } + p->nCap *= 2; + p->pArray = pArray; + } + p->pArray[p->nSize++] = Entry; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ static inline void Vec_IntPushOrder( Vec_Int_t * p, int Entry ) { int i; @@ -516,6 +551,26 @@ static inline int Vec_IntPop( Vec_Int_t * p ) /**Function************************************************************* + Synopsis [Find entry.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static inline int Vec_IntFind( Vec_Int_t * p, int Entry ) +{ + int i; + for ( i = 0; i < p->nSize; i++ ) + if ( p->pArray[i] == Entry ) + return i; + return -1; +} + +/**Function************************************************************* + Synopsis [] Description [] @@ -525,16 +580,19 @@ static inline int Vec_IntPop( Vec_Int_t * p ) SeeAlso [] ***********************************************************************/ -static inline void Vec_IntRemove( Vec_Int_t * p, int Entry ) +static inline int Vec_IntRemove( Vec_Int_t * p, int Entry ) { int i; for ( i = 0; i < p->nSize; i++ ) if ( p->pArray[i] == Entry ) break; + if ( i == p->nSize ) + return 0; assert( i < p->nSize ); for ( i++; i < p->nSize; i++ ) p->pArray[i-1] = p->pArray[i]; p->nSize--; + return 1; } /**Function************************************************************* |