abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
vecPtr.h File Reference
#include <stdio.h>

Go to the source code of this file.

Data Structures

struct  Vec_Ptr_t_
 

Macros

#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)   for ( i = 0; (i < Vec_PtrSize(vVec)) && (((pEntry) = (Type)Vec_PtrEntry(vVec, i)), 1); i++ )
 MACRO DEFINITIONS ///. More...
 
#define Vec_PtrForEachEntryStart(Type, vVec, pEntry, i, Start)   for ( i = Start; (i < Vec_PtrSize(vVec)) && (((pEntry) = (Type)Vec_PtrEntry(vVec, i)), 1); i++ )
 
#define Vec_PtrForEachEntryStop(Type, vVec, pEntry, i, Stop)   for ( i = 0; (i < Stop) && (((pEntry) = (Type)Vec_PtrEntry(vVec, i)), 1); i++ )
 
#define Vec_PtrForEachEntryStartStop(Type, vVec, pEntry, i, Start, Stop)   for ( i = Start; (i < Stop) && (((pEntry) = (Type)Vec_PtrEntry(vVec, i)), 1); i++ )
 
#define Vec_PtrForEachEntryReverse(Type, vVec, pEntry, i)   for ( i = Vec_PtrSize(vVec) - 1; (i >= 0) && (((pEntry) = (Type)Vec_PtrEntry(vVec, i)), 1); i-- )
 
#define Vec_PtrForEachEntryTwo(Type1, vVec1, Type2, vVec2, pEntry1, pEntry2, i)   for ( i = 0; (i < Vec_PtrSize(vVec1)) && (((pEntry1) = (Type1)Vec_PtrEntry(vVec1, i)), 1) && (((pEntry2) = (Type2)Vec_PtrEntry(vVec2, i)), 1); i++ )
 

Typedefs

typedef
typedefABC_NAMESPACE_HEADER_START
struct Vec_Ptr_t_ 
Vec_Ptr_t
 INCLUDES ///. More...
 

Functions

static Vec_Ptr_tVec_PtrAlloc (int nCap)
 FUNCTION DEFINITIONS ///. More...
 
static Vec_Ptr_tVec_PtrStart (int nSize)
 
static Vec_Ptr_tVec_PtrAllocArray (void **pArray, int nSize)
 
static Vec_Ptr_tVec_PtrAllocArrayCopy (void **pArray, int nSize)
 
static Vec_Ptr_tVec_PtrDup (Vec_Ptr_t *pVec)
 
static Vec_Ptr_tVec_PtrDupStr (Vec_Ptr_t *pVec)
 
static Vec_Ptr_tVec_PtrDupArray (Vec_Ptr_t *pVec)
 
static void Vec_PtrFree (Vec_Ptr_t *p)
 
static void Vec_PtrFreeP (Vec_Ptr_t **p)
 
static void ** Vec_PtrReleaseArray (Vec_Ptr_t *p)
 
static void ** Vec_PtrArray (Vec_Ptr_t *p)
 
static int Vec_PtrSize (Vec_Ptr_t *p)
 
static int Vec_PtrCap (Vec_Ptr_t *p)
 
static double Vec_PtrMemory (Vec_Ptr_t *p)
 
static int Vec_PtrCountZero (Vec_Ptr_t *p)
 
static void * Vec_PtrEntry (Vec_Ptr_t *p, int i)
 
static void ** Vec_PtrEntryP (Vec_Ptr_t *p, int i)
 
static void Vec_PtrWriteEntry (Vec_Ptr_t *p, int i, void *Entry)
 
static void * Vec_PtrEntryLast (Vec_Ptr_t *p)
 
static void Vec_PtrGrow (Vec_Ptr_t *p, int nCapMin)
 
static void Vec_PtrFill (Vec_Ptr_t *p, int nSize, void *Entry)
 
static void Vec_PtrFillExtra (Vec_Ptr_t *p, int nSize, void *Fill)
 
static void * Vec_PtrGetEntry (Vec_Ptr_t *p, int i)
 
static void Vec_PtrSetEntry (Vec_Ptr_t *p, int i, void *Entry)
 
static void Vec_PtrShrink (Vec_Ptr_t *p, int nSizeNew)
 
static void Vec_PtrClear (Vec_Ptr_t *p)
 
static void Vec_PtrFreeData (Vec_Ptr_t *p)
 
static void Vec_PtrFreeFree (Vec_Ptr_t *p)
 
static void Vec_PtrCopy (Vec_Ptr_t *pDest, Vec_Ptr_t *pSour)
 
static void Vec_PtrPush (Vec_Ptr_t *p, void *Entry)
 
static void Vec_PtrPushFirst (Vec_Ptr_t *p, void *Entry)
 
static int Vec_PtrPushUnique (Vec_Ptr_t *p, void *Entry)
 
static void * Vec_PtrPop (Vec_Ptr_t *p)
 
static int Vec_PtrFind (Vec_Ptr_t *p, void *Entry)
 
static void Vec_PtrRemove (Vec_Ptr_t *p, void *Entry)
 
static void Vec_PtrInsert (Vec_Ptr_t *p, int iHere, void *Entry)
 
static void Vec_PtrReorder (Vec_Ptr_t *p, int nItems)
 
static void Vec_PtrReverseOrder (Vec_Ptr_t *p)
 
static int Vec_PtrEqual (Vec_Ptr_t *p1, Vec_Ptr_t *p2)
 
static int Vec_PtrSortComparePtr (void **pp1, void **pp2)
 
static void Vec_PtrSort (Vec_Ptr_t *p, int(*Vec_PtrSortCompare)()) ___unused
 
static void Vec_PtrUniqify (Vec_Ptr_t *p, int(*Vec_PtrSortCompare)()) ___unused
 
static void Vec_PtrUniqify2 (Vec_Ptr_t *p, int(*Vec_PtrSortCompare)(void **, void **), void(*Vec_PtrObjFree)(void *), Vec_Int_t *vCounts) ___unused
 
static Vec_Ptr_tVec_PtrAllocSimInfo (int nEntries, int nWords)
 
static int Vec_PtrReadWordsSimInfo (Vec_Ptr_t *p)
 
static void Vec_PtrCleanSimInfo (Vec_Ptr_t *vInfo, int iWord, int nWords)
 
static void Vec_PtrFillSimInfo (Vec_Ptr_t *vInfo, int iWord, int nWords)
 
static void Vec_PtrDoubleSimInfo (Vec_Ptr_t *vInfo)
 
static void Vec_PtrReallocSimInfo (Vec_Ptr_t *vInfo)
 
static Vec_Ptr_tVec_PtrAllocTruthTables (int nVars)
 

Macro Definition Documentation

#define Vec_PtrForEachEntry (   Type,
  vVec,
  pEntry,
 
)    for ( i = 0; (i < Vec_PtrSize(vVec)) && (((pEntry) = (Type)Vec_PtrEntry(vVec, i)), 1); i++ )

MACRO DEFINITIONS ///.

Definition at line 55 of file vecPtr.h.

#define Vec_PtrForEachEntryReverse (   Type,
  vVec,
  pEntry,
 
)    for ( i = Vec_PtrSize(vVec) - 1; (i >= 0) && (((pEntry) = (Type)Vec_PtrEntry(vVec, i)), 1); i-- )

Definition at line 63 of file vecPtr.h.

#define Vec_PtrForEachEntryStart (   Type,
  vVec,
  pEntry,
  i,
  Start 
)    for ( i = Start; (i < Vec_PtrSize(vVec)) && (((pEntry) = (Type)Vec_PtrEntry(vVec, i)), 1); i++ )

Definition at line 57 of file vecPtr.h.

#define Vec_PtrForEachEntryStartStop (   Type,
  vVec,
  pEntry,
  i,
  Start,
  Stop 
)    for ( i = Start; (i < Stop) && (((pEntry) = (Type)Vec_PtrEntry(vVec, i)), 1); i++ )

Definition at line 61 of file vecPtr.h.

#define Vec_PtrForEachEntryStop (   Type,
  vVec,
  pEntry,
  i,
  Stop 
)    for ( i = 0; (i < Stop) && (((pEntry) = (Type)Vec_PtrEntry(vVec, i)), 1); i++ )

Definition at line 59 of file vecPtr.h.

#define Vec_PtrForEachEntryTwo (   Type1,
  vVec1,
  Type2,
  vVec2,
  pEntry1,
  pEntry2,
 
)    for ( i = 0; (i < Vec_PtrSize(vVec1)) && (((pEntry1) = (Type1)Vec_PtrEntry(vVec1, i)), 1) && (((pEntry2) = (Type2)Vec_PtrEntry(vVec2, i)), 1); i++ )

Definition at line 65 of file vecPtr.h.

Typedef Documentation

typedef typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t

INCLUDES ///.

CFile****************************************************************

FileName [vecPtr.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Resizable arrays.]

Synopsis [Resizable arrays of generic pointers.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id:
vecPtr.h,v 1.00 2005/06/20 00:00:00 alanmi Exp

]PARAMETERS ///BASIC TYPES ///

Definition at line 42 of file vecPtr.h.

Function Documentation

static Vec_Ptr_t* Vec_PtrAlloc ( int  nCap)
inlinestatic

FUNCTION DEFINITIONS ///.

Function*************************************************************

Synopsis [Allocates a vector with the given capacity.]

Description []

SideEffects []

SeeAlso []

Definition at line 83 of file vecPtr.h.

84 {
85  Vec_Ptr_t * p;
86  p = ABC_ALLOC( Vec_Ptr_t, 1 );
87  if ( nCap > 0 && nCap < 8 )
88  nCap = 8;
89  p->nSize = 0;
90  p->nCap = nCap;
91  p->pArray = p->nCap? ABC_ALLOC( void *, p->nCap ) : NULL;
92  return p;
93 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static Vec_Ptr_t* Vec_PtrAllocArray ( void **  pArray,
int  nSize 
)
inlinestatic

Function*************************************************************

Synopsis [Creates the vector from an integer array of the given size.]

Description []

SideEffects []

SeeAlso []

Definition at line 126 of file vecPtr.h.

127 {
128  Vec_Ptr_t * p;
129  p = ABC_ALLOC( Vec_Ptr_t, 1 );
130  p->nSize = nSize;
131  p->nCap = nSize;
132  p->pArray = pArray;
133  return p;
134 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static Vec_Ptr_t* Vec_PtrAllocArrayCopy ( void **  pArray,
int  nSize 
)
inlinestatic

Function*************************************************************

Synopsis [Creates the vector from an integer array of the given size.]

Description []

SideEffects []

SeeAlso []

Definition at line 147 of file vecPtr.h.

148 {
149  Vec_Ptr_t * p;
150  p = ABC_ALLOC( Vec_Ptr_t, 1 );
151  p->nSize = nSize;
152  p->nCap = nSize;
153  p->pArray = ABC_ALLOC( void *, nSize );
154  memcpy( p->pArray, pArray, sizeof(void *) * nSize );
155  return p;
156 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
char * memcpy()
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static Vec_Ptr_t* Vec_PtrAllocSimInfo ( int  nEntries,
int  nWords 
)
inlinestatic

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 []

Definition at line 929 of file vecPtr.h.

930 {
931  void ** pMemory;
932  unsigned * pInfo;
933  int i;
934  pMemory = (void **)ABC_ALLOC( char, (sizeof(void *) + sizeof(unsigned) * nWords) * nEntries );
935  pInfo = (unsigned *)(pMemory + nEntries);
936  for ( i = 0; i < nEntries; i++ )
937  pMemory[i] = pInfo + i * nWords;
938  return Vec_PtrAllocArray( pMemory, nEntries );
939 }
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
int nWords
Definition: abcNpn.c:127
static Vec_Ptr_t * Vec_PtrAllocArray(void **pArray, int nSize)
Definition: vecPtr.h:126
static Vec_Ptr_t* Vec_PtrAllocTruthTables ( int  nVars)
inlinestatic

Function*************************************************************

Synopsis [Allocates the array of truth tables for the given number of vars.]

Description []

SideEffects []

SeeAlso []

Definition at line 1065 of file vecPtr.h.

1066 {
1067  Vec_Ptr_t * p;
1068  unsigned Masks[5] = { 0xAAAAAAAA, 0xCCCCCCCC, 0xF0F0F0F0, 0xFF00FF00, 0xFFFF0000 };
1069  unsigned * pTruth;
1070  int i, k, nWords;
1071  nWords = (nVars <= 5 ? 1 : (1 << (nVars - 5)));
1072  p = Vec_PtrAllocSimInfo( nVars, nWords );
1073  for ( i = 0; i < nVars; i++ )
1074  {
1075  pTruth = (unsigned *)p->pArray[i];
1076  if ( i < 5 )
1077  {
1078  for ( k = 0; k < nWords; k++ )
1079  pTruth[k] = Masks[i];
1080  }
1081  else
1082  {
1083  for ( k = 0; k < nWords; k++ )
1084  if ( k & (1 << (i-5)) )
1085  pTruth[k] = ~(unsigned)0;
1086  else
1087  pTruth[k] = 0;
1088  }
1089  }
1090  return p;
1091 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nWords
Definition: abcNpn.c:127
if(last==0)
Definition: sparse_int.h:34
static Vec_Ptr_t * Vec_PtrAllocSimInfo(int nEntries, int nWords)
Definition: vecPtr.h:929
static void** Vec_PtrArray ( Vec_Ptr_t p)
inlinestatic

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 279 of file vecPtr.h.

280 {
281  return p->pArray;
282 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_PtrCap ( Vec_Ptr_t p)
inlinestatic

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 311 of file vecPtr.h.

312 {
313  return p->nCap;
314 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrCleanSimInfo ( Vec_Ptr_t vInfo,
int  iWord,
int  nWords 
)
inlinestatic

Function*************************************************************

Synopsis [Cleans simulation info of each entry beginning with iWord.]

Description []

SideEffects []

SeeAlso []

Definition at line 968 of file vecPtr.h.

969 {
970  int i;
971  for ( i = 0; i < vInfo->nSize; i++ )
972  memset( (char*)Vec_PtrEntry(vInfo,i) + 4*iWord, 0, 4*(nWords-iWord) );
973 }
char * memset()
int nWords
Definition: abcNpn.c:127
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static void Vec_PtrClear ( Vec_Ptr_t p)
inlinestatic

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 545 of file vecPtr.h.

546 {
547  p->nSize = 0;
548 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrCopy ( Vec_Ptr_t pDest,
Vec_Ptr_t pSour 
)
inlinestatic

Function*************************************************************

Synopsis [Copies the interger array.]

Description []

SideEffects []

SeeAlso []

Definition at line 587 of file vecPtr.h.

588 {
589  pDest->nSize = 0;
590  Vec_PtrGrow( pDest, pSour->nSize );
591  memcpy( pDest->pArray, pSour->pArray, sizeof(void *) * pSour->nSize );
592  pDest->nSize = pSour->nSize;
593 }
static void Vec_PtrGrow(Vec_Ptr_t *p, int nCapMin)
Definition: vecPtr.h:430
char * memcpy()
static int Vec_PtrCountZero ( Vec_Ptr_t p)
inlinestatic

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 343 of file vecPtr.h.

344 {
345  int i, Counter = 0;
346  for ( i = 0; i < p->nSize; i++ )
347  Counter += (p->pArray[i] == NULL);
348  return Counter;
349 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Counter
static void Vec_PtrDoubleSimInfo ( Vec_Ptr_t vInfo)
inlinestatic

Function*************************************************************

Synopsis [Resizes the array of simulation info.]

Description [Doubles the number of objects for which siminfo is allocated.]

SideEffects []

SeeAlso []

Definition at line 1004 of file vecPtr.h.

1005 {
1006  Vec_Ptr_t * vInfoNew;
1007  int nWords;
1008  assert( Vec_PtrSize(vInfo) > 1 );
1009  // get the new array
1010  nWords = (unsigned *)Vec_PtrEntry(vInfo,1) - (unsigned *)Vec_PtrEntry(vInfo,0);
1011  vInfoNew = Vec_PtrAllocSimInfo( 2*Vec_PtrSize(vInfo), nWords );
1012  // copy the simulation info
1013  memcpy( Vec_PtrEntry(vInfoNew,0), Vec_PtrEntry(vInfo,0), Vec_PtrSize(vInfo) * nWords * 4 );
1014  // replace the array
1015  ABC_FREE( vInfo->pArray );
1016  vInfo->pArray = vInfoNew->pArray;
1017  vInfo->nSize *= 2;
1018  vInfo->nCap *= 2;
1019  // free the old array
1020  vInfoNew->pArray = NULL;
1021  ABC_FREE( vInfoNew );
1022 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
char * memcpy()
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
int nWords
Definition: abcNpn.c:127
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define assert(ex)
Definition: util_old.h:213
static Vec_Ptr_t * Vec_PtrAllocSimInfo(int nEntries, int nWords)
Definition: vecPtr.h:929
static Vec_Ptr_t* Vec_PtrDup ( Vec_Ptr_t pVec)
inlinestatic

Function*************************************************************

Synopsis [Duplicates the integer array.]

Description []

SideEffects []

SeeAlso []

Definition at line 169 of file vecPtr.h.

170 {
171  Vec_Ptr_t * p;
172  p = ABC_ALLOC( Vec_Ptr_t, 1 );
173  p->nSize = pVec->nSize;
174  p->nCap = pVec->nCap;
175  p->pArray = p->nCap? ABC_ALLOC( void *, p->nCap ) : NULL;
176  memcpy( p->pArray, pVec->pArray, sizeof(void *) * pVec->nSize );
177  return p;
178 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
char * memcpy()
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static Vec_Ptr_t* Vec_PtrDupArray ( Vec_Ptr_t pVec)
inlinestatic

Function*************************************************************

Synopsis [Transfers the array into another vector.]

Description []

SideEffects []

SeeAlso []

Definition at line 199 of file vecPtr.h.

200 {
201  Vec_Ptr_t * p;
202  p = ABC_ALLOC( Vec_Ptr_t, 1 );
203  p->nSize = pVec->nSize;
204  p->nCap = pVec->nCap;
205  p->pArray = pVec->pArray;
206  pVec->nSize = 0;
207  pVec->nCap = 0;
208  pVec->pArray = NULL;
209  return p;
210 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static Vec_Ptr_t* Vec_PtrDupStr ( Vec_Ptr_t pVec)
inlinestatic

Definition at line 179 of file vecPtr.h.

180 {
181  int i;
182  Vec_Ptr_t * p = Vec_PtrDup( pVec );
183  for ( i = 0; i < p->nSize; i++ )
184  p->pArray[i] = Abc_UtilStrsav( (char *)p->pArray[i] );
185  return p;
186 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Vec_Ptr_t * Vec_PtrDup(Vec_Ptr_t *pVec)
Definition: vecPtr.h:169
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static void* Vec_PtrEntry ( Vec_Ptr_t p,
int  i 
)
inlinestatic

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 362 of file vecPtr.h.

363 {
364  assert( i >= 0 && i < p->nSize );
365  return p->pArray[i];
366 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
static void* Vec_PtrEntryLast ( Vec_Ptr_t p)
inlinestatic

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 413 of file vecPtr.h.

414 {
415  assert( p->nSize > 0 );
416  return p->pArray[p->nSize-1];
417 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
static void** Vec_PtrEntryP ( Vec_Ptr_t p,
int  i 
)
inlinestatic

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 379 of file vecPtr.h.

380 {
381  assert( i >= 0 && i < p->nSize );
382  return p->pArray + i;
383 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
static int Vec_PtrEqual ( Vec_Ptr_t p1,
Vec_Ptr_t p2 
)
inlinestatic

Function*************************************************************

Synopsis [Checks if two vectors are equal.]

Description []

SideEffects []

SeeAlso []

Definition at line 808 of file vecPtr.h.

809 {
810  int i;
811  if ( p1->nSize != p2->nSize )
812  return 0;
813  for ( i = 0; i < p1->nSize; i++ )
814  if ( p1->pArray[i] != p2->pArray[i] )
815  return 0;
816  return 1;
817 }
static void Vec_PtrFill ( Vec_Ptr_t p,
int  nSize,
void *  Entry 
)
inlinestatic

Function*************************************************************

Synopsis [Fills the vector with given number of entries.]

Description []

SideEffects []

SeeAlso []

Definition at line 449 of file vecPtr.h.

450 {
451  int i;
452  Vec_PtrGrow( p, nSize );
453  for ( i = 0; i < nSize; i++ )
454  p->pArray[i] = Entry;
455  p->nSize = nSize;
456 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrGrow(Vec_Ptr_t *p, int nCapMin)
Definition: vecPtr.h:430
static void Vec_PtrFillExtra ( Vec_Ptr_t p,
int  nSize,
void *  Fill 
)
inlinestatic

Function*************************************************************

Synopsis [Fills the vector with given number of entries.]

Description []

SideEffects []

SeeAlso []

Definition at line 469 of file vecPtr.h.

470 {
471  int i;
472  if ( nSize <= p->nSize )
473  return;
474  if ( nSize > 2 * p->nCap )
475  Vec_PtrGrow( p, nSize );
476  else if ( nSize > p->nCap )
477  Vec_PtrGrow( p, 2 * p->nCap );
478  for ( i = p->nSize; i < nSize; i++ )
479  p->pArray[i] = Fill;
480  p->nSize = nSize;
481 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrGrow(Vec_Ptr_t *p, int nCapMin)
Definition: vecPtr.h:430
static void Vec_PtrFillSimInfo ( Vec_Ptr_t vInfo,
int  iWord,
int  nWords 
)
inlinestatic

Function*************************************************************

Synopsis [Cleans simulation info of each entry beginning with iWord.]

Description []

SideEffects []

SeeAlso []

Definition at line 986 of file vecPtr.h.

987 {
988  int i;
989  for ( i = 0; i < vInfo->nSize; i++ )
990  memset( (char*)Vec_PtrEntry(vInfo,i) + 4*iWord, 0xFF, 4*(nWords-iWord) );
991 }
char * memset()
int nWords
Definition: abcNpn.c:127
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Vec_PtrFind ( Vec_Ptr_t p,
void *  Entry 
)
inlinestatic

Function*************************************************************

Synopsis [Find entry.]

Description []

SideEffects []

SeeAlso []

Definition at line 694 of file vecPtr.h.

695 {
696  int i;
697  for ( i = 0; i < p->nSize; i++ )
698  if ( p->pArray[i] == Entry )
699  return i;
700  return -1;
701 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrFree ( Vec_Ptr_t p)
inlinestatic

Function*************************************************************

Synopsis [Frees the vector.]

Description []

SideEffects []

SeeAlso []

Definition at line 223 of file vecPtr.h.

224 {
225  ABC_FREE( p->pArray );
226  ABC_FREE( p );
227 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_FREE(obj)
Definition: abc_global.h:232
static void Vec_PtrFreeData ( Vec_Ptr_t p)
inlinestatic

Function*************************************************************

Synopsis [Deallocates array of memory pointers.]

Description []

SideEffects []

SeeAlso []

Definition at line 561 of file vecPtr.h.

562 {
563  void * pTemp; int i;
564  if ( p == NULL ) return;
565  Vec_PtrForEachEntry( void *, p, pTemp, i )
566  if ( pTemp != (void *)(ABC_PTRINT_T)1 && pTemp != (void *)(ABC_PTRINT_T)2 )
567  ABC_FREE( pTemp );
568 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
if(last==0)
Definition: sparse_int.h:34
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void Vec_PtrFreeFree ( Vec_Ptr_t p)
inlinestatic

Definition at line 569 of file vecPtr.h.

570 {
571  if ( p == NULL ) return;
572  Vec_PtrFreeData( p );
573  Vec_PtrFree( p );
574 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrFreeData(Vec_Ptr_t *p)
Definition: vecPtr.h:561
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
static void Vec_PtrFreeP ( Vec_Ptr_t **  p)
inlinestatic

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 240 of file vecPtr.h.

241 {
242  if ( *p == NULL )
243  return;
244  ABC_FREE( (*p)->pArray );
245  ABC_FREE( (*p) );
246 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_FREE(obj)
Definition: abc_global.h:232
static void* Vec_PtrGetEntry ( Vec_Ptr_t p,
int  i 
)
inlinestatic

Function*************************************************************

Synopsis [Returns the entry even if the place not exist.]

Description []

SideEffects []

SeeAlso []

Definition at line 494 of file vecPtr.h.

495 {
496  Vec_PtrFillExtra( p, i + 1, NULL );
497  return Vec_PtrEntry( p, i );
498 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrFillExtra(Vec_Ptr_t *p, int nSize, void *Fill)
Definition: vecPtr.h:469
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static void Vec_PtrGrow ( Vec_Ptr_t p,
int  nCapMin 
)
inlinestatic

Function*************************************************************

Synopsis [Resizes the vector to the given capacity.]

Description []

SideEffects []

SeeAlso []

Definition at line 430 of file vecPtr.h.

431 {
432  if ( p->nCap >= nCapMin )
433  return;
434  p->pArray = ABC_REALLOC( void *, p->pArray, nCapMin );
435  p->nCap = nCapMin;
436 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_REALLOC(type, obj, num)
Definition: abc_global.h:233
static void Vec_PtrInsert ( Vec_Ptr_t p,
int  iHere,
void *  Entry 
)
inlinestatic

Function*************************************************************

Synopsis [Interts entry at the index iHere. Shifts other entries.]

Description []

SideEffects []

SeeAlso []

Definition at line 745 of file vecPtr.h.

746 {
747  int i;
748  assert( iHere >= 0 && iHere < p->nSize );
749  Vec_PtrPush( p, 0 );
750  for ( i = p->nSize - 1; i > iHere; i-- )
751  p->pArray[i] = p->pArray[i-1];
752  p->pArray[i] = Entry;
753 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define assert(ex)
Definition: util_old.h:213
static double Vec_PtrMemory ( Vec_Ptr_t p)
inlinestatic

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 327 of file vecPtr.h.

328 {
329  return !p ? 0.0 : 1.0 * sizeof(void *) * p->nCap + sizeof(Vec_Ptr_t);
330 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void* Vec_PtrPop ( Vec_Ptr_t p)
inlinestatic

Function*************************************************************

Synopsis [Returns the last entry and removes it from the list.]

Description []

SideEffects []

SeeAlso []

Definition at line 677 of file vecPtr.h.

678 {
679  assert( p->nSize > 0 );
680  return p->pArray[--p->nSize];
681 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrPush ( Vec_Ptr_t p,
void *  Entry 
)
inlinestatic

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 606 of file vecPtr.h.

607 {
608  if ( p->nSize == p->nCap )
609  {
610  if ( p->nCap < 16 )
611  Vec_PtrGrow( p, 16 );
612  else
613  Vec_PtrGrow( p, 2 * p->nCap );
614  }
615  p->pArray[p->nSize++] = Entry;
616 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrGrow(Vec_Ptr_t *p, int nCapMin)
Definition: vecPtr.h:430
static void Vec_PtrPushFirst ( Vec_Ptr_t p,
void *  Entry 
)
inlinestatic

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 629 of file vecPtr.h.

630 {
631  int i;
632  if ( p->nSize == p->nCap )
633  {
634  if ( p->nCap < 16 )
635  Vec_PtrGrow( p, 16 );
636  else
637  Vec_PtrGrow( p, 2 * p->nCap );
638  }
639  p->nSize++;
640  for ( i = p->nSize - 1; i >= 1; i-- )
641  p->pArray[i] = p->pArray[i-1];
642  p->pArray[0] = Entry;
643 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrGrow(Vec_Ptr_t *p, int nCapMin)
Definition: vecPtr.h:430
static int Vec_PtrPushUnique ( Vec_Ptr_t p,
void *  Entry 
)
inlinestatic

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 656 of file vecPtr.h.

657 {
658  int i;
659  for ( i = 0; i < p->nSize; i++ )
660  if ( p->pArray[i] == Entry )
661  return 1;
662  Vec_PtrPush( p, Entry );
663  return 0;
664 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Vec_PtrReadWordsSimInfo ( Vec_Ptr_t p)
inlinestatic

Function*************************************************************

Synopsis [Cleans simulation info of each entry beginning with iWord.]

Description []

SideEffects []

SeeAlso []

Definition at line 952 of file vecPtr.h.

953 {
954  return (unsigned *)Vec_PtrEntry(p,1) - (unsigned *)Vec_PtrEntry(p,0);
955 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static void Vec_PtrReallocSimInfo ( Vec_Ptr_t vInfo)
inlinestatic

Function*************************************************************

Synopsis [Resizes the array of simulation info.]

Description [Doubles the number of simulation patterns stored for each object.]

SideEffects []

SeeAlso []

Definition at line 1035 of file vecPtr.h.

1036 {
1037  Vec_Ptr_t * vInfoNew;
1038  int nWords, i;
1039  assert( Vec_PtrSize(vInfo) > 1 );
1040  // get the new array
1041  nWords = (unsigned *)Vec_PtrEntry(vInfo,1) - (unsigned *)Vec_PtrEntry(vInfo,0);
1042  vInfoNew = Vec_PtrAllocSimInfo( Vec_PtrSize(vInfo), 2*nWords );
1043  // copy the simulation info
1044  for ( i = 0; i < vInfo->nSize; i++ )
1045  memcpy( Vec_PtrEntry(vInfoNew,i), Vec_PtrEntry(vInfo,i), nWords * 4 );
1046  // replace the array
1047  ABC_FREE( vInfo->pArray );
1048  vInfo->pArray = vInfoNew->pArray;
1049  // free the old array
1050  vInfoNew->pArray = NULL;
1051  ABC_FREE( vInfoNew );
1052 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
char * memcpy()
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
int nWords
Definition: abcNpn.c:127
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define assert(ex)
Definition: util_old.h:213
static Vec_Ptr_t * Vec_PtrAllocSimInfo(int nEntries, int nWords)
Definition: vecPtr.h:929
static void** Vec_PtrReleaseArray ( Vec_Ptr_t p)
inlinestatic

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 259 of file vecPtr.h.

260 {
261  void ** pArray = p->pArray;
262  p->nCap = 0;
263  p->nSize = 0;
264  p->pArray = NULL;
265  return pArray;
266 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrRemove ( Vec_Ptr_t p,
void *  Entry 
)
inlinestatic

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 714 of file vecPtr.h.

715 {
716  int i;
717  // delete assuming that it is closer to the end
718  for ( i = p->nSize - 1; i >= 0; i-- )
719  if ( p->pArray[i] == Entry )
720  break;
721  assert( i >= 0 );
722 /*
723  // delete assuming that it is closer to the beginning
724  for ( i = 0; i < p->nSize; i++ )
725  if ( p->pArray[i] == Entry )
726  break;
727  assert( i < p->nSize );
728 */
729  for ( i++; i < p->nSize; i++ )
730  p->pArray[i-1] = p->pArray[i];
731  p->nSize--;
732 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrReorder ( Vec_Ptr_t p,
int  nItems 
)
inlinestatic

Function*************************************************************

Synopsis [Moves the first nItems to the end.]

Description []

SideEffects []

SeeAlso []

Definition at line 766 of file vecPtr.h.

767 {
768  assert( nItems < p->nSize );
769  Vec_PtrGrow( p, nItems + p->nSize );
770  memmove( (char **)p->pArray + p->nSize, p->pArray, nItems * sizeof(void*) );
771  memmove( p->pArray, (char **)p->pArray + nItems, p->nSize * sizeof(void*) );
772 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrGrow(Vec_Ptr_t *p, int nCapMin)
Definition: vecPtr.h:430
char * memmove()
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrReverseOrder ( Vec_Ptr_t p)
inlinestatic

Function*************************************************************

Synopsis [Reverses the order of entries.]

Description []

SideEffects []

SeeAlso []

Definition at line 785 of file vecPtr.h.

786 {
787  void * Temp;
788  int i;
789  for ( i = 0; i < p->nSize/2; i++ )
790  {
791  Temp = p->pArray[i];
792  p->pArray[i] = p->pArray[p->nSize-1-i];
793  p->pArray[p->nSize-1-i] = Temp;
794  }
795 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrSetEntry ( Vec_Ptr_t p,
int  i,
void *  Entry 
)
inlinestatic

Function*************************************************************

Synopsis [Inserts the entry even if the place does not exist.]

Description []

SideEffects []

SeeAlso []

Definition at line 511 of file vecPtr.h.

512 {
513  Vec_PtrFillExtra( p, i + 1, NULL );
514  Vec_PtrWriteEntry( p, i, Entry );
515 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrFillExtra(Vec_Ptr_t *p, int nSize, void *Fill)
Definition: vecPtr.h:469
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static void Vec_PtrShrink ( Vec_Ptr_t p,
int  nSizeNew 
)
inlinestatic

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 528 of file vecPtr.h.

529 {
530  assert( p->nSize >= nSizeNew );
531  p->nSize = nSizeNew;
532 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
static int Vec_PtrSize ( Vec_Ptr_t p)
inlinestatic

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 295 of file vecPtr.h.

296 {
297  return p->nSize;
298 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrSort ( Vec_Ptr_t p,
int(*)()  Vec_PtrSortCompare 
)
static

Function*************************************************************

Synopsis [Sorting the entries by their integer value.]

Description []

SideEffects []

SeeAlso []

Definition at line 851 of file vecPtr.h.

852 {
853  if ( p->nSize < 2 )
854  return;
855  if ( Vec_PtrSortCompare == NULL )
856  qsort( (void *)p->pArray, p->nSize, sizeof(void *),
857  (int (*)(const void *, const void *)) Vec_PtrSortComparePtr );
858  else
859  qsort( (void *)p->pArray, p->nSize, sizeof(void *),
860  (int (*)(const void *, const void *)) Vec_PtrSortCompare );
861 }
static int Vec_PtrSortComparePtr(void **pp1, void **pp2)
Definition: vecPtr.h:830
static int Vec_PtrSortCompare(void **pp1, void **pp2)
Definition: abcLutmin.c:351
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_PtrSortComparePtr ( void **  pp1,
void **  pp2 
)
static

Function*************************************************************

Synopsis [Comparison procedure for two integers.]

Description []

SideEffects []

SeeAlso []

Definition at line 830 of file vecPtr.h.

831 {
832  if ( *pp1 < *pp2 )
833  return -1;
834  if ( *pp1 > *pp2 )
835  return 1;
836  return 0;
837 }
static Vec_Ptr_t* Vec_PtrStart ( int  nSize)
inlinestatic

Function*************************************************************

Synopsis [Allocates a vector with the given size and cleans it.]

Description []

SideEffects []

SeeAlso []

Definition at line 106 of file vecPtr.h.

107 {
108  Vec_Ptr_t * p;
109  p = Vec_PtrAlloc( nSize );
110  p->nSize = nSize;
111  memset( p->pArray, 0, sizeof(void *) * nSize );
112  return p;
113 }
char * memset()
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static void Vec_PtrUniqify ( Vec_Ptr_t p,
int(*)()  Vec_PtrSortCompare 
)
static

Function*************************************************************

Synopsis [Sorting the entries by their integer value.]

Description []

SideEffects []

SeeAlso []

Definition at line 875 of file vecPtr.h.

876 {
877  int i, k;
878  if ( p->nSize < 2 )
879  return;
881  for ( i = k = 1; i < p->nSize; i++ )
882  if ( p->pArray[i] != p->pArray[i-1] )
883  p->pArray[k++] = p->pArray[i];
884  p->nSize = k;
885 }
static int Vec_PtrSortCompare(void **pp1, void **pp2)
Definition: abcLutmin.c:351
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrSort(Vec_Ptr_t *p, int(*Vec_PtrSortCompare)()) ___unused
Definition: vecPtr.h:851
static void Vec_PtrUniqify2 ( Vec_Ptr_t p,
int(*)(void **, void **)  Vec_PtrSortCompare,
void(*)(void *)  Vec_PtrObjFree,
Vec_Int_t vCounts 
)
static

Definition at line 887 of file vecPtr.h.

888 {
889  int i, k;
890  if ( vCounts )
891  Vec_IntFill( vCounts, 1, 1 );
892  if ( p->nSize < 2 )
893  return;
894  Vec_PtrSort( p, (int (*)())Vec_PtrSortCompare );
895  for ( i = k = 1; i < p->nSize; i++ )
896  if ( Vec_PtrSortCompare(p->pArray+i, p->pArray+k-1) != 0 )
897  {
898  p->pArray[k++] = p->pArray[i];
899  if ( vCounts )
900  Vec_IntPush( vCounts, 1 );
901  }
902  else
903  {
904  if ( Vec_PtrObjFree )
905  Vec_PtrObjFree( p->pArray[i] );
906  if ( vCounts )
907  Vec_IntAddToEntry( vCounts, Vec_IntSize(vCounts)-1, 1 );
908  }
909  p->nSize = k;
910  assert( vCounts == NULL || Vec_IntSize(vCounts) == Vec_PtrSize(p) );
911 }
static int Vec_PtrSortCompare(void **pp1, void **pp2)
Definition: abcLutmin.c:351
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrSort(Vec_Ptr_t *p, int(*Vec_PtrSortCompare)()) ___unused
Definition: vecPtr.h:851
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void Vec_IntAddToEntry(Vec_Int_t *p, int i, int Addition)
Definition: bblif.c:302
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrWriteEntry ( Vec_Ptr_t p,
int  i,
void *  Entry 
)
inlinestatic

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 396 of file vecPtr.h.

397 {
398  assert( i >= 0 && i < p->nSize );
399  p->pArray[i] = Entry;
400 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213