From ecda331a2a921bcac30bf3210f56adf9152ca22f Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Tue, 14 Sep 2021 22:01:41 -0700 Subject: Various changes. --- src/misc/vec/vecInt.h | 6 ++++++ src/misc/vec/vecWec.h | 23 +++++++++++++++++++++++ 2 files changed, 29 insertions(+) (limited to 'src/misc/vec') 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 @@ -548,6 +548,29 @@ static inline void Vec_WecSortByLastInt( Vec_Wec_t * p, int fReverse ) (int (*)(const void *, const void *)) Vec_WecSortCompare5 ); } +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + 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 [] -- cgit v1.2.3