summaryrefslogtreecommitdiffstats
path: root/src/misc
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2021-10-22 00:00:01 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2021-10-22 00:00:01 -0700
commitd4f073bad759874161e2de5952ef7d466bc3eb07 (patch)
treee6e2606155dafe4ddd3df74656ffee8e5be8b7e6 /src/misc
parentabc54a2d207f45e2b556eea0bcb26ca8798a33c3 (diff)
downloadabc-d4f073bad759874161e2de5952ef7d466bc3eb07.tar.gz
abc-d4f073bad759874161e2de5952ef7d466bc3eb07.tar.bz2
abc-d4f073bad759874161e2de5952ef7d466bc3eb07.zip
Various changes.
Diffstat (limited to 'src/misc')
-rw-r--r--src/misc/util/utilTruth.h30
-rw-r--r--src/misc/vec/vecPtr.h20
-rw-r--r--src/misc/vec/vecWrd.h4
3 files changed, 39 insertions, 15 deletions
diff --git a/src/misc/util/utilTruth.h b/src/misc/util/utilTruth.h
index dbc0e5a0..d9efa55f 100644
--- a/src/misc/util/utilTruth.h
+++ b/src/misc/util/utilTruth.h
@@ -2106,12 +2106,15 @@ static inline int Abc_TtCountOnes( word x )
x = x + (x >> 32);
return (int)(x & 0xFF);
}
+static inline int Abc_TtCountOnes2( word x )
+{
+ return x ? Abc_TtCountOnes(x) : 0;
+}
static inline int Abc_TtCountOnesVec( word * x, int nWords )
{
int w, Count = 0;
for ( w = 0; w < nWords; w++ )
- if ( x[w] )
- Count += Abc_TtCountOnes( x[w] );
+ Count += Abc_TtCountOnes2( x[w] );
return Count;
}
static inline int Abc_TtCountOnesVecMask( word * x, word * pMask, int nWords, int fCompl )
@@ -2120,14 +2123,12 @@ static inline int Abc_TtCountOnesVecMask( word * x, word * pMask, int nWords, in
if ( fCompl )
{
for ( w = 0; w < nWords; w++ )
- if ( pMask[w] & ~x[w] )
- Count += Abc_TtCountOnes( pMask[w] & ~x[w] );
+ Count += Abc_TtCountOnes2( pMask[w] & ~x[w] );
}
else
{
for ( w = 0; w < nWords; w++ )
- if ( pMask[w] & x[w] )
- Count += Abc_TtCountOnes( pMask[w] & x[w] );
+ Count += Abc_TtCountOnes2( pMask[w] & x[w] );
}
return Count;
}
@@ -2136,24 +2137,23 @@ static inline int Abc_TtCountOnesVecMask2( word * x0, word * x1, int fComp0, int
int w, Count = 0;
if ( !fComp0 && !fComp1 )
for ( w = 0; w < nWords; w++ )
- Count += Abc_TtCountOnes( pMask[w] & x0[w] & x1[w] );
+ Count += Abc_TtCountOnes2( pMask[w] & x0[w] & x1[w] );
else if ( fComp0 && !fComp1 )
for ( w = 0; w < nWords; w++ )
- Count += Abc_TtCountOnes( pMask[w] & ~x0[w] & x1[w] );
+ Count += Abc_TtCountOnes2( pMask[w] & ~x0[w] & x1[w] );
else if ( !fComp0 && fComp1 )
for ( w = 0; w < nWords; w++ )
- Count += Abc_TtCountOnes( pMask[w] & x0[w] & ~x1[w] );
+ Count += Abc_TtCountOnes2( pMask[w] & x0[w] & ~x1[w] );
else
for ( w = 0; w < nWords; w++ )
- Count += Abc_TtCountOnes( pMask[w] & ~x0[w] & ~x1[w] );
+ Count += Abc_TtCountOnes2( pMask[w] & ~x0[w] & ~x1[w] );
return Count;
}
static inline int Abc_TtCountOnesVecXor( word * x, word * y, int nWords )
{
int w, Count = 0;
for ( w = 0; w < nWords; w++ )
- if ( x[w] ^ y[w] )
- Count += Abc_TtCountOnes( x[w] ^ y[w] );
+ Count += Abc_TtCountOnes2( x[w] ^ y[w] );
return Count;
}
static inline int Abc_TtCountOnesVecXorMask( word * x, word * y, int fCompl, word * pMask, int nWords )
@@ -2161,10 +2161,10 @@ static inline int Abc_TtCountOnesVecXorMask( word * x, word * y, int fCompl, wor
int w, Count = 0;
if ( fCompl )
for ( w = 0; w < nWords; w++ )
- Count += Abc_TtCountOnes( pMask[w] & (x[w] ^ ~y[w]) );
+ Count += Abc_TtCountOnes2( pMask[w] & (x[w] ^ ~y[w]) );
else
for ( w = 0; w < nWords; w++ )
- Count += Abc_TtCountOnes( pMask[w] & (x[w] ^ y[w]) );
+ Count += Abc_TtCountOnes2( pMask[w] & (x[w] ^ y[w]) );
return Count;
}
static inline int Abc_TtAndXorSum( word * pOut, word * pIn1, word * pIn2, int nWords )
@@ -2173,7 +2173,7 @@ static inline int Abc_TtAndXorSum( word * pOut, word * pIn1, word * pIn2, int nW
for ( w = 0; w < nWords; w++ )
{
pOut[w] &= pIn1[w] ^ pIn2[w];
- Count += Abc_TtCountOnes( pOut[w] );
+ Count += Abc_TtCountOnes2( pOut[w] );
}
return Count;
}
diff --git a/src/misc/vec/vecPtr.h b/src/misc/vec/vecPtr.h
index 565e0474..0f024f68 100644
--- a/src/misc/vec/vecPtr.h
+++ b/src/misc/vec/vecPtr.h
@@ -607,6 +607,26 @@ static inline void Vec_PtrFreeFree( Vec_Ptr_t * p )
/**Function*************************************************************
+ Synopsis []
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+static void Vec_PtrFreeFunc( Vec_Ptr_t * p, void (*pFuncItemFree)(void *) ) ___unused;
+static void Vec_PtrFreeFunc( Vec_Ptr_t * p, void (*pFuncItemFree)(void *) )
+{
+ void * pItem; int i;
+ Vec_PtrForEachEntry( void *, p, pItem, i )
+ if ( pItem ) pFuncItemFree( pItem );
+ Vec_PtrFree( p );
+}
+
+/**Function*************************************************************
+
Synopsis [Copies the interger array.]
Description []
diff --git a/src/misc/vec/vecWrd.h b/src/misc/vec/vecWrd.h
index 32c78626..8275702a 100644
--- a/src/misc/vec/vecWrd.h
+++ b/src/misc/vec/vecWrd.h
@@ -382,6 +382,10 @@ static inline int Vec_WrdSize( Vec_Wrd_t * p )
{
return p->nSize;
}
+static inline int Vec_WrdChangeSize( Vec_Wrd_t * p, int Shift )
+{
+ return p->nSize += Shift;
+}
/**Function*************************************************************