summaryrefslogtreecommitdiffstats
path: root/src/misc
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2005-08-27 08:01:00 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2005-08-27 08:01:00 -0700
commit28db025b8393e307328d51ff6901c4ebab669e95 (patch)
tree3866dd659505646c64eccdb672930bf0ebb849c2 /src/misc
parent9093ca53201519ef03dedb7044345fc716cc0643 (diff)
downloadabc-28db025b8393e307328d51ff6901c4ebab669e95.tar.gz
abc-28db025b8393e307328d51ff6901c4ebab669e95.tar.bz2
abc-28db025b8393e307328d51ff6901c4ebab669e95.zip
Version abc50827
Diffstat (limited to 'src/misc')
-rw-r--r--src/misc/extra/extraUtilMisc.c2
-rw-r--r--src/misc/vec/vecFan.h2
-rw-r--r--src/misc/vec/vecInt.h26
-rw-r--r--src/misc/vec/vecPtr.h26
-rw-r--r--src/misc/vec/vecStr.h2
-rw-r--r--src/misc/vec/vecVec.h30
6 files changed, 78 insertions, 10 deletions
diff --git a/src/misc/extra/extraUtilMisc.c b/src/misc/extra/extraUtilMisc.c
index a12fbce4..d5b0330f 100644
--- a/src/misc/extra/extraUtilMisc.c
+++ b/src/misc/extra/extraUtilMisc.c
@@ -674,7 +674,7 @@ void Extra_Truth4VarNPN( unsigned short ** puCanons, char ** puPhases, char ** p
if ( uCanons[uTruth] )
{
assert( uTruth > uCanons[uTruth] );
- uMap[uTruth] = uMap[uCanons[uTruth]];
+ uMap[~uTruth & 0xFFFF] = uMap[uTruth] = uMap[uCanons[uTruth]];
continue;
}
uMap[uTruth] = nClasses++;
diff --git a/src/misc/vec/vecFan.h b/src/misc/vec/vecFan.h
index 8698a1b7..08d1d734 100644
--- a/src/misc/vec/vecFan.h
+++ b/src/misc/vec/vecFan.h
@@ -47,8 +47,8 @@ struct Abc_Fan_t_ // 1 word
typedef struct Vec_Fan_t_ Vec_Fan_t;
struct Vec_Fan_t_
{
- int nSize;
int nCap;
+ int nSize;
Abc_Fan_t * pArray;
};
diff --git a/src/misc/vec/vecInt.h b/src/misc/vec/vecInt.h
index 919b7e5a..793dd567 100644
--- a/src/misc/vec/vecInt.h
+++ b/src/misc/vec/vecInt.h
@@ -39,8 +39,8 @@
typedef struct Vec_Int_t_ Vec_Int_t;
struct Vec_Int_t_
{
- int nSize;
int nCap;
+ int nSize;
int * pArray;
};
@@ -322,9 +322,31 @@ static inline void Vec_IntFill( Vec_Int_t * p, int nSize, int Entry )
{
int i;
Vec_IntGrow( p, nSize );
+ for ( i = 0; i < nSize; i++ )
+ p->pArray[i] = Entry;
p->nSize = nSize;
- for ( i = 0; i < p->nSize; i++ )
+}
+
+/**Function*************************************************************
+
+ Synopsis [Fills the vector with given number of entries.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+static inline void Vec_IntFillExtra( Vec_Int_t * p, int nSize, int Entry )
+{
+ int i;
+ if ( p->nSize >= nSize )
+ return;
+ Vec_IntGrow( p, nSize );
+ for ( i = p->nSize; i < nSize; i++ )
p->pArray[i] = Entry;
+ p->nSize = nSize;
}
/**Function*************************************************************
diff --git a/src/misc/vec/vecPtr.h b/src/misc/vec/vecPtr.h
index ed78c8c2..1d3e0633 100644
--- a/src/misc/vec/vecPtr.h
+++ b/src/misc/vec/vecPtr.h
@@ -39,8 +39,8 @@
typedef struct Vec_Ptr_t_ Vec_Ptr_t;
struct Vec_Ptr_t_
{
- int nSize;
int nCap;
+ int nSize;
void ** pArray;
};
@@ -323,9 +323,31 @@ static inline void Vec_PtrFill( Vec_Ptr_t * p, int nSize, void * Entry )
{
int i;
Vec_PtrGrow( p, nSize );
+ for ( i = 0; i < nSize; i++ )
+ p->pArray[i] = Entry;
p->nSize = nSize;
- for ( i = 0; i < p->nSize; i++ )
+}
+
+/**Function*************************************************************
+
+ Synopsis [Fills the vector with given number of entries.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+static inline void Vec_PtrFillExtra( Vec_Ptr_t * p, int nSize, void * Entry )
+{
+ int i;
+ if ( p->nSize >= nSize )
+ return;
+ Vec_PtrGrow( p, nSize );
+ for ( i = p->nSize; i < nSize; i++ )
p->pArray[i] = Entry;
+ p->nSize = nSize;
}
/**Function*************************************************************
diff --git a/src/misc/vec/vecStr.h b/src/misc/vec/vecStr.h
index 2a9dc7a0..4b8e6a1c 100644
--- a/src/misc/vec/vecStr.h
+++ b/src/misc/vec/vecStr.h
@@ -39,8 +39,8 @@
typedef struct Vec_Str_t_ Vec_Str_t;
struct Vec_Str_t_
{
- int nSize;
int nCap;
+ int nSize;
char * pArray;
};
diff --git a/src/misc/vec/vecVec.h b/src/misc/vec/vecVec.h
index 4ee62080..bb911bfe 100644
--- a/src/misc/vec/vecVec.h
+++ b/src/misc/vec/vecVec.h
@@ -39,9 +39,9 @@
typedef struct Vec_Vec_t_ Vec_Vec_t;
struct Vec_Vec_t_
{
- int nSize;
- int nCap;
- void ** pArray;
+ int nCap;
+ int nSize;
+ void ** pArray;
};
////////////////////////////////////////////////////////////////////////
@@ -55,6 +55,8 @@ struct Vec_Vec_t_
for ( i = LevelStart; (i < Vec_PtrSize(vGlob)) && (((vVec) = Vec_VecEntry(vGlob, i)), 1); i++ )
#define Vec_VecForEachLevelStartStop( vGlob, vVec, i, LevelStart, LevelStop ) \
for ( i = LevelStart; (i <= LevelStop) && (((vVec) = Vec_VecEntry(vGlob, i)), 1); i++ )
+#define Vec_VecForEachLevelReverse( vGlob, vVec, i ) \
+ for ( i = Vec_VecSize(vGlob) - 1; (i >= 0) && (((vVec) = Vec_VecEntry(vGlob, i)), 1); i-- )
// iteratores through entries
#define Vec_VecForEachEntry( vGlob, pEntry, i, k ) \
@@ -96,6 +98,28 @@ static inline Vec_Vec_t * Vec_VecAlloc( int nCap )
/**Function*************************************************************
+ Synopsis [Allocates a vector with the given capacity.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+static inline Vec_Vec_t * Vec_VecStart( int nSize )
+{
+ Vec_Vec_t * p;
+ int i;
+ p = Vec_VecAlloc( nSize );
+ for ( i = 0; i < nSize; i++ )
+ p->pArray[i] = Vec_PtrAlloc( 0 );
+ p->nSize = nSize;
+ return p;
+}
+
+/**Function*************************************************************
+
Synopsis []
Description []