summaryrefslogtreecommitdiffstats
path: root/src/misc/vec/vecInt.h
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2012-03-25 01:24:26 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2012-03-25 01:24:26 -0700
commit309bcf2dec92b745c3ec0078691997823317c58b (patch)
tree5f337a761438710c12a7cc8680581874195a9e2f /src/misc/vec/vecInt.h
parentabb889fe6e0a567f69fe4bb328d717e15df04ac6 (diff)
downloadabc-309bcf2dec92b745c3ec0078691997823317c58b.tar.gz
abc-309bcf2dec92b745c3ec0078691997823317c58b.tar.bz2
abc-309bcf2dec92b745c3ec0078691997823317c58b.zip
Logic sharing for multi-input gates.
Diffstat (limited to 'src/misc/vec/vecInt.h')
-rw-r--r--src/misc/vec/vecInt.h32
1 files changed, 32 insertions, 0 deletions
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*************************************************************