diff options
Diffstat (limited to 'src/misc/vec')
-rw-r--r-- | src/misc/vec/vecInt.h | 21 | ||||
-rw-r--r-- | src/misc/vec/vecPtr.h | 20 | ||||
-rw-r--r-- | src/misc/vec/vecStr.h | 4 |
3 files changed, 43 insertions, 2 deletions
diff --git a/src/misc/vec/vecInt.h b/src/misc/vec/vecInt.h index 5a627623..fd8dbc86 100644 --- a/src/misc/vec/vecInt.h +++ b/src/misc/vec/vecInt.h @@ -540,6 +540,27 @@ static inline void Vec_IntPushOrder( Vec_Int_t * p, int Entry ) /**Function************************************************************* + Synopsis [Inserts the entry while preserving the increasing order.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static inline int Vec_IntPushUniqueOrder( Vec_Int_t * p, int Entry ) +{ + int i; + for ( i = 0; i < p->nSize; i++ ) + if ( p->pArray[i] == Entry ) + return 1; + Vec_IntPushOrder( p, Entry ); + return 0; +} + +/**Function************************************************************* + Synopsis [] Description [] diff --git a/src/misc/vec/vecPtr.h b/src/misc/vec/vecPtr.h index 65314af6..63dcc9b8 100644 --- a/src/misc/vec/vecPtr.h +++ b/src/misc/vec/vecPtr.h @@ -472,6 +472,26 @@ static inline void * Vec_PtrPop( Vec_Ptr_t * p ) /**Function************************************************************* + Synopsis [Find entry.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static inline int Vec_PtrFind( Vec_Ptr_t * p, void * Entry ) +{ + int i; + for ( i = 0; i < p->nSize; i++ ) + if ( p->pArray[i] == Entry ) + return i; + return -1; +} + +/**Function************************************************************* + Synopsis [] Description [] diff --git a/src/misc/vec/vecStr.h b/src/misc/vec/vecStr.h index 5549d374..4cda06f0 100644 --- a/src/misc/vec/vecStr.h +++ b/src/misc/vec/vecStr.h @@ -494,10 +494,10 @@ static inline int Vec_StrSortCompare2( char * pp1, char * pp2 ) static inline void Vec_StrSort( Vec_Str_t * p, int fReverse ) { if ( fReverse ) - qsort( (void *)p->pArray, p->nSize, sizeof(int), + qsort( (void *)p->pArray, p->nSize, sizeof(char), (int (*)(const void *, const void *)) Vec_StrSortCompare2 ); else - qsort( (void *)p->pArray, p->nSize, sizeof(int), + qsort( (void *)p->pArray, p->nSize, sizeof(char), (int (*)(const void *, const void *)) Vec_StrSortCompare1 ); } |