summaryrefslogtreecommitdiffstats
path: root/src/misc/vec
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2021-09-14 22:01:41 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2021-09-14 22:01:41 -0700
commitecda331a2a921bcac30bf3210f56adf9152ca22f (patch)
tree665fe58212a5ad8eb29cbe9acdc55a7981d3b1b7 /src/misc/vec
parentc557272241645ab98d2bb6fa0941a32802e0c765 (diff)
downloadabc-ecda331a2a921bcac30bf3210f56adf9152ca22f.tar.gz
abc-ecda331a2a921bcac30bf3210f56adf9152ca22f.tar.bz2
abc-ecda331a2a921bcac30bf3210f56adf9152ca22f.zip
Various changes.
Diffstat (limited to 'src/misc/vec')
-rw-r--r--src/misc/vec/vecInt.h6
-rw-r--r--src/misc/vec/vecWec.h23
2 files changed, 29 insertions, 0 deletions
diff --git a/src/misc/vec/vecInt.h b/src/misc/vec/vecInt.h
index cbe20903..c2f8cd61 100644
--- a/src/misc/vec/vecInt.h
+++ b/src/misc/vec/vecInt.h
@@ -780,6 +780,12 @@ static inline void Vec_IntPushArray( Vec_Int_t * p, int * pEntries, int nEntries
for ( i = 0; i < nEntries; i++ )
Vec_IntPush( p, pEntries[i] );
}
+static inline void Vec_IntShift( Vec_Int_t * p, int Shift )
+{
+ p->nSize -= Shift;
+ p->nCap -= Shift;
+ p->pArray += Shift;
+}
/**Function*************************************************************
diff --git a/src/misc/vec/vecWec.h b/src/misc/vec/vecWec.h
index 26d026c7..2be08d04 100644
--- a/src/misc/vec/vecWec.h
+++ b/src/misc/vec/vecWec.h
@@ -559,6 +559,29 @@ static inline void Vec_WecSortByLastInt( Vec_Wec_t * p, int fReverse )
SeeAlso []
***********************************************************************/
+static inline void Vec_WecKeepLevels( Vec_Wec_t * p, int Limit )
+{
+ Vec_Int_t * vLevel; int i, k = 0;
+ Vec_WecForEachLevel( p, vLevel, i )
+ if ( Vec_IntSize(vLevel) > Limit )
+ {
+ ABC_SWAP( Vec_Int_t, Vec_WecArray(p)[i], Vec_WecArray(p)[k] );
+ k++;
+ }
+ Vec_WecShrink( p, k );
+}
+
+/**Function*************************************************************
+
+ Synopsis []
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
static inline void Vec_WecPrint( Vec_Wec_t * p, int fSkipSingles )
{
Vec_Int_t * vVec;