From 309bcf2dec92b745c3ec0078691997823317c58b Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Sun, 25 Mar 2012 01:24:26 -0700 Subject: Logic sharing for multi-input gates. --- src/misc/vec/vecInt.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src/misc/vec/vecInt.h') diff --git a/src/misc/vec/vecInt.h b/src/misc/vec/vecInt.h index 882326b2..4422fc85 100644 --- a/src/misc/vec/vecInt.h +++ b/src/misc/vec/vecInt.h @@ -1251,6 +1251,38 @@ static inline Vec_Int_t * Vec_IntTwoMerge( Vec_Int_t * vArr1, Vec_Int_t * vArr2 return vArr; } +/**Function************************************************************* + + Synopsis [Returns the result of merging the two vectors.] + + Description [Assumes that the vectors are sorted in the increasing order.] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static inline void Vec_IntTwoSplit( Vec_Int_t * vArr1, Vec_Int_t * vArr2, Vec_Int_t * vArr, Vec_Int_t * vArr1n, Vec_Int_t * vArr2n ) +{ + int * pBeg1 = vArr1->pArray; + int * pBeg2 = vArr2->pArray; + int * pEnd1 = vArr1->pArray + vArr1->nSize; + int * pEnd2 = vArr2->pArray + vArr2->nSize; + while ( pBeg1 < pEnd1 && pBeg2 < pEnd2 ) + { + if ( *pBeg1 == *pBeg2 ) + Vec_IntPush( vArr, *pBeg1++ ), pBeg2++; + else if ( *pBeg1 < *pBeg2 ) + Vec_IntPush( vArr1n, *pBeg1++ ); + else + Vec_IntPush( vArr2n, *pBeg2++ ); + } + while ( pBeg1 < pEnd1 ) + Vec_IntPush( vArr1n, *pBeg1++ ); + while ( pBeg2 < pEnd2 ) + Vec_IntPush( vArr2n, *pBeg2++ ); +} + /**Function************************************************************* -- cgit v1.2.3