summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/aig/gia/giaAiger.c8
-rw-r--r--src/aig/gia/giaPat2.c2
-rw-r--r--src/misc/vec/vecInt.h64
3 files changed, 70 insertions, 4 deletions
diff --git a/src/aig/gia/giaAiger.c b/src/aig/gia/giaAiger.c
index 1bb70612..aafe311b 100644
--- a/src/aig/gia/giaAiger.c
+++ b/src/aig/gia/giaAiger.c
@@ -1702,8 +1702,8 @@ int * Aiger_Read( char * pFileName, int * pnObjs, int * pnIns, int * pnLats, int
int uLit = 2*(1 + nIns + nLats + i);
int uLit1 = uLit - Aiger_ReadUnsigned( pFile );
int uLit0 = uLit1 - Aiger_ReadUnsigned( pFile );
- pObjs[2*(1+nIns+i)+0] = uLit0;
- pObjs[2*(1+nIns+i)+1] = uLit1;
+ pObjs[2*(1+nIns+nLats+i)+0] = uLit0;
+ pObjs[2*(1+nIns+nLats+i)+1] = uLit1;
}
fclose( pFile );
if ( pnObjs ) *pnObjs = nObjs;
@@ -1729,8 +1729,8 @@ void Aiger_Write( char * pFileName, int * pObjs, int nObjs, int nIns, int nLats,
for ( i = 0; i < nAnds; i++ )
{
int uLit = 2*(1 + nIns + nLats + i);
- int uLit0 = pObjs[2*(1+nIns+i)+0];
- int uLit1 = pObjs[2*(1+nIns+i)+1];
+ int uLit0 = pObjs[2*(1+nIns+nLats+i)+0];
+ int uLit1 = pObjs[2*(1+nIns+nLats+i)+1];
Aiger_WriteUnsigned( pFile, uLit - uLit1 );
Aiger_WriteUnsigned( pFile, uLit1 - uLit0 );
}
diff --git a/src/aig/gia/giaPat2.c b/src/aig/gia/giaPat2.c
index 094bdee1..f14ce34a 100644
--- a/src/aig/gia/giaPat2.c
+++ b/src/aig/gia/giaPat2.c
@@ -1242,6 +1242,8 @@ Vec_Wrd_t * Min_ManRemapSims( int nInputs, Vec_Int_t * vMap, Vec_Wrd_t * vSimsPi
{
int i, iObj, nWords = Vec_WrdSize(vSimsPi)/Vec_IntSize(vMap);
Vec_Wrd_t * vSimsNew = Vec_WrdStart( 2 * nInputs * nWords );
+ //Vec_Wrd_t * vSimsNew = Vec_WrdStartRandom( nInputs * nWords );
+ //Vec_WrdFillExtra( vSimsNew, 2 * nInputs * nWords, 0 );
assert( Vec_WrdSize(vSimsPi)%Vec_IntSize(vMap) == 0 );
Vec_WrdShrink( vSimsNew, Vec_WrdSize(vSimsNew)/2 );
Vec_IntForEachEntry( vMap, iObj, i )
diff --git a/src/misc/vec/vecInt.h b/src/misc/vec/vecInt.h
index 89a9096a..83122796 100644
--- a/src/misc/vec/vecInt.h
+++ b/src/misc/vec/vecInt.h
@@ -1934,6 +1934,70 @@ static inline int Vec_IntTwoRemove( Vec_Int_t * vArr1, Vec_Int_t * vArr2 )
Synopsis [Returns the result of merging the two vectors.]
+ Description [Keeps only those entries of vArr1, which are in vArr2.]
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+static inline void Vec_IntTwoMerge1( Vec_Int_t * vArr1, Vec_Int_t * vArr2 )
+{
+ int * pBeg = vArr1->pArray;
+ 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 )
+ *pBeg++ = *pBeg1++, pBeg2++;
+ else if ( *pBeg1 < *pBeg2 )
+ *pBeg1++;
+ else
+ *pBeg2++;
+ }
+ assert( vArr1->nSize >= pBeg - vArr1->pArray );
+ vArr1->nSize = pBeg - vArr1->pArray;
+}
+
+/**Function*************************************************************
+
+ Synopsis [Returns the result of subtracting for two vectors.]
+
+ Description [Keeps only those entries of vArr1, which are not in vArr2.]
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+static inline void Vec_IntTwoRemove1( Vec_Int_t * vArr1, Vec_Int_t * vArr2 )
+{
+ int * pBeg = vArr1->pArray;
+ 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 )
+ *pBeg1++, pBeg2++;
+ else if ( *pBeg1 < *pBeg2 )
+ *pBeg++ = *pBeg1++;
+ else
+ *pBeg2++;
+ }
+ while ( pBeg1 < pEnd1 )
+ *pBeg++ = *pBeg1++;
+ assert( vArr1->nSize >= pBeg - vArr1->pArray );
+ vArr1->nSize = pBeg - vArr1->pArray;
+}
+
+/**Function*************************************************************
+
+ Synopsis [Returns the result of merging the two vectors.]
+
Description [Assumes that the vectors are sorted in the increasing order.]
SideEffects []