summaryrefslogtreecommitdiffstats
path: root/src/misc/vec/vecInt.h
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2011-10-15 22:04:05 +0300
committerAlan Mishchenko <alanmi@berkeley.edu>2011-10-15 22:04:05 +0300
commit6f0b87dd5c5c7f4f5dec04e9c146d60188acf3c2 (patch)
tree7cf4aae5a053ccfc02cfb93aea949fc76d83e3c8 /src/misc/vec/vecInt.h
parente4bd4d54408a6677927062ad86d2537dcce42f9d (diff)
downloadabc-6f0b87dd5c5c7f4f5dec04e9c146d60188acf3c2.tar.gz
abc-6f0b87dd5c5c7f4f5dec04e9c146d60188acf3c2.tar.bz2
abc-6f0b87dd5c5c7f4f5dec04e9c146d60188acf3c2.zip
New abstraction code.
Diffstat (limited to 'src/misc/vec/vecInt.h')
-rw-r--r--src/misc/vec/vecInt.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/misc/vec/vecInt.h b/src/misc/vec/vecInt.h
index 545cf8a6..ec17795e 100644
--- a/src/misc/vec/vecInt.h
+++ b/src/misc/vec/vecInt.h
@@ -657,6 +657,36 @@ static inline void Vec_IntPushOrder( Vec_Int_t * p, int Entry )
SeeAlso []
***********************************************************************/
+static inline void Vec_IntPushOrderReverse( Vec_Int_t * p, int Entry )
+{
+ int i;
+ if ( p->nSize == p->nCap )
+ {
+ if ( p->nCap < 16 )
+ Vec_IntGrow( p, 16 );
+ else
+ Vec_IntGrow( p, 2 * p->nCap );
+ }
+ p->nSize++;
+ for ( i = p->nSize-2; i >= 0; i-- )
+ if ( p->pArray[i] < Entry )
+ p->pArray[i+1] = p->pArray[i];
+ else
+ break;
+ p->pArray[i+1] = 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;