Commit a80a91e4 by Alan Mishchenko

Bug fix and new procedures.

parent d13e33cd
...@@ -1702,8 +1702,8 @@ int * Aiger_Read( char * pFileName, int * pnObjs, int * pnIns, int * pnLats, int ...@@ -1702,8 +1702,8 @@ int * Aiger_Read( char * pFileName, int * pnObjs, int * pnIns, int * pnLats, int
int uLit = 2*(1 + nIns + nLats + i); int uLit = 2*(1 + nIns + nLats + i);
int uLit1 = uLit - Aiger_ReadUnsigned( pFile ); int uLit1 = uLit - Aiger_ReadUnsigned( pFile );
int uLit0 = uLit1 - Aiger_ReadUnsigned( pFile ); int uLit0 = uLit1 - Aiger_ReadUnsigned( pFile );
pObjs[2*(1+nIns+i)+0] = uLit0; pObjs[2*(1+nIns+nLats+i)+0] = uLit0;
pObjs[2*(1+nIns+i)+1] = uLit1; pObjs[2*(1+nIns+nLats+i)+1] = uLit1;
} }
fclose( pFile ); fclose( pFile );
if ( pnObjs ) *pnObjs = nObjs; if ( pnObjs ) *pnObjs = nObjs;
...@@ -1729,8 +1729,8 @@ void Aiger_Write( char * pFileName, int * pObjs, int nObjs, int nIns, int nLats, ...@@ -1729,8 +1729,8 @@ void Aiger_Write( char * pFileName, int * pObjs, int nObjs, int nIns, int nLats,
for ( i = 0; i < nAnds; i++ ) for ( i = 0; i < nAnds; i++ )
{ {
int uLit = 2*(1 + nIns + nLats + i); int uLit = 2*(1 + nIns + nLats + i);
int uLit0 = pObjs[2*(1+nIns+i)+0]; int uLit0 = pObjs[2*(1+nIns+nLats+i)+0];
int uLit1 = pObjs[2*(1+nIns+i)+1]; int uLit1 = pObjs[2*(1+nIns+nLats+i)+1];
Aiger_WriteUnsigned( pFile, uLit - uLit1 ); Aiger_WriteUnsigned( pFile, uLit - uLit1 );
Aiger_WriteUnsigned( pFile, uLit1 - uLit0 ); Aiger_WriteUnsigned( pFile, uLit1 - uLit0 );
} }
......
...@@ -1242,6 +1242,8 @@ Vec_Wrd_t * Min_ManRemapSims( int nInputs, Vec_Int_t * vMap, Vec_Wrd_t * vSimsPi ...@@ -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); int i, iObj, nWords = Vec_WrdSize(vSimsPi)/Vec_IntSize(vMap);
Vec_Wrd_t * vSimsNew = Vec_WrdStart( 2 * nInputs * nWords ); 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 ); assert( Vec_WrdSize(vSimsPi)%Vec_IntSize(vMap) == 0 );
Vec_WrdShrink( vSimsNew, Vec_WrdSize(vSimsNew)/2 ); Vec_WrdShrink( vSimsNew, Vec_WrdSize(vSimsNew)/2 );
Vec_IntForEachEntry( vMap, iObj, i ) Vec_IntForEachEntry( vMap, iObj, i )
......
...@@ -1934,6 +1934,70 @@ static inline int Vec_IntTwoRemove( Vec_Int_t * vArr1, Vec_Int_t * vArr2 ) ...@@ -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.] 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.] Description [Assumes that the vectors are sorted in the increasing order.]
SideEffects [] SideEffects []
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment