summaryrefslogtreecommitdiffstats
path: root/src/misc/vec/vecPtr.h
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2007-03-30 08:01:00 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2007-03-30 08:01:00 -0700
commit028138a76eb74eee80f1d9592f43bdbe0d4c3d6c (patch)
tree99371b5ea7fded49c4b914b0cb6e207fb580b2cf /src/misc/vec/vecPtr.h
parent4da784c049b79b76d8c1b82297bd27f45ead9377 (diff)
downloadabc-028138a76eb74eee80f1d9592f43bdbe0d4c3d6c.tar.gz
abc-028138a76eb74eee80f1d9592f43bdbe0d4c3d6c.tar.bz2
abc-028138a76eb74eee80f1d9592f43bdbe0d4c3d6c.zip
Version abc70330
Diffstat (limited to 'src/misc/vec/vecPtr.h')
-rw-r--r--src/misc/vec/vecPtr.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/misc/vec/vecPtr.h b/src/misc/vec/vecPtr.h
index a53e439a..272e7b40 100644
--- a/src/misc/vec/vecPtr.h
+++ b/src/misc/vec/vecPtr.h
@@ -177,6 +177,45 @@ static inline Vec_Ptr_t * Vec_PtrAllocSimInfo( int nEntries, int nWords )
/**Function*************************************************************
+ Synopsis [Allocates the array of truth tables for the given number of vars.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+static inline Vec_Ptr_t * Vec_PtrAllocTruthTables( int nVars )
+{
+ Vec_Ptr_t * p;
+ unsigned Masks[5] = { 0xAAAAAAAA, 0xCCCCCCCC, 0xF0F0F0F0, 0xFF00FF00, 0xFFFF0000 };
+ unsigned * pTruth;
+ int i, k, nWords;
+ nWords = (nVars <= 5 ? 1 : (1 << (nVars - 5)));
+ p = Vec_PtrAllocSimInfo( nVars, nWords );
+ for ( i = 0; i < nVars; i++ )
+ {
+ pTruth = p->pArray[i];
+ if ( i < 5 )
+ {
+ for ( k = 0; k < nWords; k++ )
+ pTruth[k] = Masks[i];
+ }
+ else
+ {
+ for ( k = 0; k < nWords; k++ )
+ if ( k & (1 << (i-5)) )
+ pTruth[k] = ~(unsigned)0;
+ else
+ pTruth[k] = 0;
+ }
+ }
+ return p;
+}
+
+/**Function*************************************************************
+
Synopsis [Duplicates the integer array.]
Description []