diff options
author | Bruno Schmitt <bruno@oschmitt.com> | 2017-01-25 13:40:31 +0900 |
---|---|---|
committer | Bruno Schmitt <bruno@oschmitt.com> | 2017-01-25 13:40:31 +0900 |
commit | 876eb5a52e67911ccc19d5f732aa9e1c9279fd26 (patch) | |
tree | 4a78999c29676235f613b4e1f8e1d1d0983107ba /src/misc/vec/vecInt.h | |
parent | 123b425052636beceaa52e47ea695d35b75fb40a (diff) | |
parent | 51f4dab475af1ffd22d23b5aeb8d7cf243739f75 (diff) | |
download | abc-876eb5a52e67911ccc19d5f732aa9e1c9279fd26.tar.gz abc-876eb5a52e67911ccc19d5f732aa9e1c9279fd26.tar.bz2 abc-876eb5a52e67911ccc19d5f732aa9e1c9279fd26.zip |
Merged alanmi/abc into default
Diffstat (limited to 'src/misc/vec/vecInt.h')
-rw-r--r-- | src/misc/vec/vecInt.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/misc/vec/vecInt.h b/src/misc/vec/vecInt.h index f09b8783..d952518f 100644 --- a/src/misc/vec/vecInt.h +++ b/src/misc/vec/vecInt.h @@ -1692,6 +1692,24 @@ static inline int Vec_IntTwoFindCommon( Vec_Int_t * vArr1, Vec_Int_t * vArr2, Ve } return Vec_IntSize(vArr); } +static inline int Vec_IntTwoFindCommonReverse( Vec_Int_t * vArr1, Vec_Int_t * vArr2, Vec_Int_t * vArr ) +{ + int * pBeg1 = vArr1->pArray; + int * pBeg2 = vArr2->pArray; + int * pEnd1 = vArr1->pArray + vArr1->nSize; + int * pEnd2 = vArr2->pArray + vArr2->nSize; + Vec_IntClear( vArr ); + while ( pBeg1 < pEnd1 && pBeg2 < pEnd2 ) + { + if ( *pBeg1 == *pBeg2 ) + Vec_IntPush( vArr, *pBeg1 ), pBeg1++, pBeg2++; + else if ( *pBeg1 > *pBeg2 ) + pBeg1++; + else + pBeg2++; + } + return Vec_IntSize(vArr); +} /**Function************************************************************* |