diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2013-04-27 15:23:12 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2013-04-27 15:23:12 -0700 |
commit | 324d73c29a22766063df46f9e35a3cbe719a83c2 (patch) | |
tree | a1f9bddaf945d689c458f95893d8424da0dbf816 /src/misc/vec/vecInt.h | |
parent | ae9a4407c4abf4200365faceb9d8cac0d99236b3 (diff) | |
download | abc-324d73c29a22766063df46f9e35a3cbe719a83c2.tar.gz abc-324d73c29a22766063df46f9e35a3cbe719a83c2.tar.bz2 abc-324d73c29a22766063df46f9e35a3cbe719a83c2.zip |
New fast extract.
Diffstat (limited to 'src/misc/vec/vecInt.h')
-rw-r--r-- | src/misc/vec/vecInt.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/misc/vec/vecInt.h b/src/misc/vec/vecInt.h index 9744a031..60352a0f 100644 --- a/src/misc/vec/vecInt.h +++ b/src/misc/vec/vecInt.h @@ -1193,6 +1193,24 @@ static inline int Vec_IntUniqify( Vec_Int_t * p ) p->nSize = k; return RetValue; } +static inline int Vec_IntCountDuplicates( Vec_Int_t * p ) +{ + int RetValue; + Vec_Int_t * pDup = Vec_IntDup( p ); + Vec_IntUniqify( pDup ); + RetValue = Vec_IntSize(p) - Vec_IntSize(pDup); + Vec_IntFree( pDup ); + return RetValue; +} +static inline int Vec_IntCheckUniqueSmall( Vec_Int_t * p ) +{ + int i, k; + for ( i = 0; i < p->nSize; i++ ) + for ( k = i+1; k < p->nSize; k++ ) + if ( p->pArray[i] == p->pArray[k] ) + return 0; + return 1; +} /**Function************************************************************* |