summaryrefslogtreecommitdiffstats
path: root/src/misc/vec
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2007-01-15 08:01:00 -0800
committerAlan Mishchenko <alanmi@berkeley.edu>2007-01-15 08:01:00 -0800
commit93aedd2c5155478de7602db4db2c2df4c73e32e0 (patch)
treeb0d3cd0a54e6f0b555bd82e44112fd2ec935f19c /src/misc/vec
parent8dfe404863427d5e7b18d055ffd78b453835f959 (diff)
downloadabc-93aedd2c5155478de7602db4db2c2df4c73e32e0.tar.gz
abc-93aedd2c5155478de7602db4db2c2df4c73e32e0.tar.bz2
abc-93aedd2c5155478de7602db4db2c2df4c73e32e0.zip
Version abc70115
Diffstat (limited to 'src/misc/vec')
-rw-r--r--src/misc/vec/vecPtr.h26
-rw-r--r--src/misc/vec/vecVec.h2
2 files changed, 28 insertions, 0 deletions
diff --git a/src/misc/vec/vecPtr.h b/src/misc/vec/vecPtr.h
index 552c5293..c6b8defb 100644
--- a/src/misc/vec/vecPtr.h
+++ b/src/misc/vec/vecPtr.h
@@ -151,6 +151,32 @@ static inline Vec_Ptr_t * Vec_PtrAllocArrayCopy( void ** pArray, int nSize )
/**Function*************************************************************
+ Synopsis [Allocates the array of simulation info.]
+
+ Description [Allocates the array containing given number of entries,
+ each of which contains given number of unsigned words of simulation data.
+ The resulting array can be freed using regular procedure Vec_PtrFree().
+ It is the responsibility of the user to ensure this array is never grown.]
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+static inline Vec_Ptr_t * Vec_PtrAllocSimInfo( int nEntries, int nWords )
+{
+ void ** pMemory;
+ unsigned * pInfo;
+ int i;
+ pMemory = (void **)ALLOC( char, (sizeof(void *) + sizeof(unsigned) * nWords) * nEntries );
+ pInfo = (unsigned *)(pMemory + nEntries);
+ for ( i = 0; i < nEntries; i++ )
+ pMemory[i] = pInfo + i * nWords;
+ return Vec_PtrAllocArray( pMemory, nEntries );
+}
+
+/**Function*************************************************************
+
Synopsis [Duplicates the integer array.]
Description []
diff --git a/src/misc/vec/vecVec.h b/src/misc/vec/vecVec.h
index 9176ec04..6bfc49d5 100644
--- a/src/misc/vec/vecVec.h
+++ b/src/misc/vec/vecVec.h
@@ -61,6 +61,8 @@ struct Vec_Vec_t_
#define Vec_VecForEachEntry( vGlob, pEntry, i, k ) \
for ( i = 0; i < Vec_VecSize(vGlob); i++ ) \
Vec_PtrForEachEntry( Vec_VecEntry(vGlob, i), pEntry, k )
+#define Vec_VecForEachEntryLevel( vGlob, pEntry, i, Level ) \
+ Vec_PtrForEachEntry( Vec_VecEntry(vGlob, Level), pEntry, i )
#define Vec_VecForEachEntryStart( vGlob, pEntry, i, k, LevelStart ) \
for ( i = LevelStart; i < Vec_VecSize(vGlob); i++ ) \
Vec_PtrForEachEntry( Vec_VecEntry(vGlob, i), pEntry, k )