From 4da784c049b79b76d8c1b82297bd27f45ead9377 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Wed, 28 Mar 2007 08:01:00 -0700 Subject: Version abc70328 --- src/misc/vec/vecPtr.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/misc/vec') diff --git a/src/misc/vec/vecPtr.h b/src/misc/vec/vecPtr.h index 6b23d1ac..a53e439a 100644 --- a/src/misc/vec/vecPtr.h +++ b/src/misc/vec/vecPtr.h @@ -307,6 +307,37 @@ static inline void * Vec_PtrEntry( Vec_Ptr_t * p, int i ) return p->pArray[i]; } +/**Function************************************************************* + + Synopsis [Resizes the array of simulation info.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static inline void Vec_PtrDoubleSimInfo( Vec_Ptr_t * vInfo ) +{ + Vec_Ptr_t * vInfoNew; + int nWords; + assert( Vec_PtrSize(vInfo) > 2 ); + // get the new array + nWords = (unsigned *)Vec_PtrEntry(vInfo,1) - (unsigned *)Vec_PtrEntry(vInfo,0); + vInfoNew = Vec_PtrAllocSimInfo( 2*Vec_PtrSize(vInfo), nWords ); + // copy the simulation info + memcpy( Vec_PtrEntry(vInfoNew,0), Vec_PtrEntry(vInfo,0), Vec_PtrSize(vInfo) * nWords * 4 ); + // replace the array + free( vInfo->pArray ); + vInfo->pArray = vInfoNew->pArray; + vInfo->nSize *= 2; + vInfo->nCap *= 2; + // free the old array + vInfoNew->pArray = NULL; + free( vInfoNew ); +} + /**Function************************************************************* Synopsis [] -- cgit v1.2.3