summaryrefslogtreecommitdiffstats
path: root/src/misc/util
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2014-08-04 15:34:34 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2014-08-04 15:34:34 -0700
commita3a6002b3d663757dd0ca8112c29e51dced7bcfe (patch)
tree55af85db342dcfa739050c82df76133fd07c757b /src/misc/util
parent1d9d6814ee20412a37fcda79a333d9d7e3fee1d4 (diff)
downloadabc-a3a6002b3d663757dd0ca8112c29e51dced7bcfe.tar.gz
abc-a3a6002b3d663757dd0ca8112c29e51dced7bcfe.tar.bz2
abc-a3a6002b3d663757dd0ca8112c29e51dced7bcfe.zip
Compiler warnings.
Diffstat (limited to 'src/misc/util')
-rw-r--r--src/misc/util/utilTruth.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/misc/util/utilTruth.h b/src/misc/util/utilTruth.h
index a45f62ea..ee1784fb 100644
--- a/src/misc/util/utilTruth.h
+++ b/src/misc/util/utilTruth.h
@@ -53,6 +53,15 @@ static word s_Truths6Neg[6] = {
ABC_CONST(0x00000000FFFFFFFF)
};
+static word s_TruthXors[6] = {
+ ABC_CONST(0x0000000000000000),
+ ABC_CONST(0x6666666666666666),
+ ABC_CONST(0x6969696969696969),
+ ABC_CONST(0x6996699669966996),
+ ABC_CONST(0x6996966969969669),
+ ABC_CONST(0x6996966996696996)
+};
+
static word s_PMasks[5][3] = {
{ ABC_CONST(0x9999999999999999), ABC_CONST(0x2222222222222222), ABC_CONST(0x4444444444444444) },
{ ABC_CONST(0xC3C3C3C3C3C3C3C3), ABC_CONST(0x0C0C0C0C0C0C0C0C), ABC_CONST(0x3030303030303030) },
@@ -163,6 +172,19 @@ static inline int Abc_TtHexDigitNum( int nVars ) { return nVars <= 2 ? 1 : 1 <<
/**Function*************************************************************
+ Synopsis [Bit mask.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+static inline word Abc_Tt6Mask( int nBits ) { assert( nBits >= 0 && nBits <= 64 ); return (~(word)0) >> (64-nBits); }
+
+/**Function*************************************************************
+
Synopsis []
Description []
@@ -949,6 +971,37 @@ static inline int Abc_Tt6SupportAndSize( word t, int nVars, int * pSuppSize )
/**Function*************************************************************
+ Synopsis [Detecting elementary functions.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+static inline int Abc_TtOnlyOneOne( word t )
+{
+ if ( t == 0 )
+ return 0;
+ return (t & (t-1)) == 0;
+}
+static inline int Gia_ManTtIsAndType( word t, int nVars )
+{
+ return Abc_TtOnlyOneOne( t & Abc_Tt6Mask(1 << nVars) );
+}
+static inline int Gia_ManTtIsOrType( word t, int nVars )
+{
+ return Abc_TtOnlyOneOne( ~t & Abc_Tt6Mask(1 << nVars) );
+}
+static inline int Gia_ManTtIsXorType( word t, int nVars )
+{
+ return ((((t & 1) ? ~t : t) ^ s_TruthXors[nVars]) & Abc_Tt6Mask(1 << nVars)) == 0;
+}
+
+
+/**Function*************************************************************
+
Synopsis []
Description []