diff options
Diffstat (limited to 'src/misc')
-rw-r--r-- | src/misc/util/utilTruth.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/misc/util/utilTruth.h b/src/misc/util/utilTruth.h index cb567096..b8a34da7 100644 --- a/src/misc/util/utilTruth.h +++ b/src/misc/util/utilTruth.h @@ -266,6 +266,28 @@ static inline void Abc_TtAnd( word * pOut, word * pIn1, word * pIn2, int nWords, for ( w = 0; w < nWords; w++ ) pOut[w] = pIn1[w] & pIn2[w]; } +static inline void Abc_TtAndCompl( word * pOut, word * pIn1, int fCompl1, word * pIn2, int fCompl2, int nWords ) +{ + int w; + if ( fCompl1 ) + { + if ( fCompl2 ) + for ( w = 0; w < nWords; w++ ) + pOut[w] = ~pIn1[w] & ~pIn2[w]; + else + for ( w = 0; w < nWords; w++ ) + pOut[w] = ~pIn1[w] & pIn2[w]; + } + else + { + if ( fCompl2 ) + for ( w = 0; w < nWords; w++ ) + pOut[w] = pIn1[w] & ~pIn2[w]; + else + for ( w = 0; w < nWords; w++ ) + pOut[w] = pIn1[w] & pIn2[w]; + } +} static inline void Abc_TtAndSharp( word * pOut, word * pIn1, word * pIn2, int nWords, int fCompl ) { int w; @@ -288,6 +310,12 @@ static inline void Abc_TtOr( word * pOut, word * pIn1, word * pIn2, int nWords ) for ( w = 0; w < nWords; w++ ) pOut[w] = pIn1[w] | pIn2[w]; } +static inline void Abc_TtOrXor( word * pOut, word * pIn1, word * pIn2, int nWords ) +{ + int w; + for ( w = 0; w < nWords; w++ ) + pOut[w] |= pIn1[w] ^ pIn2[w]; +} static inline void Abc_TtXor( word * pOut, word * pIn1, word * pIn2, int nWords, int fCompl ) { int w; @@ -1603,6 +1631,14 @@ static inline int Abc_TtFindFirstBit( word * pIn, int nVars ) return 64*w + Abc_Tt6FirstBit(pIn[w]); return -1; } +static inline int Abc_TtFindFirstDiffBit( word * pIn1, word * pIn2, int nVars ) +{ + int w, nWords = Abc_TtWordNum(nVars); + for ( w = 0; w < nWords; w++ ) + if ( pIn1[w] ^ pIn2[w] ) + return 64*w + Abc_Tt6FirstBit(pIn1[w] ^ pIn2[w]); + return -1; +} static inline int Abc_TtFindFirstZero( word * pIn, int nVars ) { int w, nWords = Abc_TtWordNum(nVars); |