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

Go to the source code of this file.

Data Structures

struct  Vec_Wrd_t_
 

Macros

#define Vec_WrdForEachEntry(vVec, Entry, i)   for ( i = 0; (i < Vec_WrdSize(vVec)) && (((Entry) = Vec_WrdEntry(vVec, i)), 1); i++ )
 MACRO DEFINITIONS ///. More...
 
#define Vec_WrdForEachEntryStart(vVec, Entry, i, Start)   for ( i = Start; (i < Vec_WrdSize(vVec)) && (((Entry) = Vec_WrdEntry(vVec, i)), 1); i++ )
 
#define Vec_WrdForEachEntryStop(vVec, Entry, i, Stop)   for ( i = 0; (i < Stop) && (((Entry) = Vec_WrdEntry(vVec, i)), 1); i++ )
 
#define Vec_WrdForEachEntryStartStop(vVec, Entry, i, Start, Stop)   for ( i = Start; (i < Stop) && (((Entry) = Vec_WrdEntry(vVec, i)), 1); i++ )
 
#define Vec_WrdForEachEntryReverse(vVec, pEntry, i)   for ( i = Vec_WrdSize(vVec) - 1; (i >= 0) && (((pEntry) = Vec_WrdEntry(vVec, i)), 1); i-- )
 

Typedefs

typedef
typedefABC_NAMESPACE_HEADER_START
struct Vec_Wrd_t_ 
Vec_Wrd_t
 INCLUDES ///. More...
 

Functions

static Vec_Wrd_tVec_WrdAlloc (int nCap)
 FUNCTION DEFINITIONS ///. More...
 
static Vec_Wrd_tVec_WrdStart (int nSize)
 
static Vec_Wrd_tVec_WrdStartFull (int nSize)
 
static Vec_Wrd_tVec_WrdStartNatural (int nSize)
 
static Vec_Wrd_tVec_WrdAllocArray (word *pArray, int nSize)
 
static Vec_Wrd_tVec_WrdAllocArrayCopy (word *pArray, int nSize)
 
static Vec_Wrd_tVec_WrdDup (Vec_Wrd_t *pVec)
 
static Vec_Wrd_tVec_WrdDupArray (Vec_Wrd_t *pVec)
 
static void Vec_WrdErase (Vec_Wrd_t *p)
 
static void Vec_WrdFree (Vec_Wrd_t *p)
 
static void Vec_WrdFreeP (Vec_Wrd_t **p)
 
static wordVec_WrdReleaseArray (Vec_Wrd_t *p)
 
static wordVec_WrdArray (Vec_Wrd_t *p)
 
static wordVec_WrdLimit (Vec_Wrd_t *p)
 
static int Vec_WrdSize (Vec_Wrd_t *p)
 
static int Vec_WrdCap (Vec_Wrd_t *p)
 
static double Vec_WrdMemory (Vec_Wrd_t *p)
 
static word Vec_WrdEntry (Vec_Wrd_t *p, int i)
 
static wordVec_WrdEntryP (Vec_Wrd_t *p, int i)
 
static void Vec_WrdWriteEntry (Vec_Wrd_t *p, int i, word Entry)
 
static word Vec_WrdAddToEntry (Vec_Wrd_t *p, int i, word Addition)
 
static word Vec_WrdEntryLast (Vec_Wrd_t *p)
 
static void Vec_WrdGrow (Vec_Wrd_t *p, int nCapMin)
 
static void Vec_WrdFill (Vec_Wrd_t *p, int nSize, word Fill)
 
static void Vec_WrdFillExtra (Vec_Wrd_t *p, int nSize, word Fill)
 
static word Vec_WrdGetEntry (Vec_Wrd_t *p, int i)
 
static wordVec_WrdGetEntryP (Vec_Wrd_t *p, int i)
 
static void Vec_WrdSetEntry (Vec_Wrd_t *p, int i, word Entry)
 
static void Vec_WrdShrink (Vec_Wrd_t *p, int nSizeNew)
 
static void Vec_WrdClear (Vec_Wrd_t *p)
 
static void Vec_WrdPush (Vec_Wrd_t *p, word Entry)
 
static void Vec_WrdPushFirst (Vec_Wrd_t *p, word Entry)
 
static void Vec_WrdPushOrder (Vec_Wrd_t *p, word Entry)
 
static int Vec_WrdPushUniqueOrder (Vec_Wrd_t *p, word Entry)
 
static int Vec_WrdPushUnique (Vec_Wrd_t *p, word Entry)
 
static wordVec_WrdFetch (Vec_Wrd_t *p, int nWords)
 
static word Vec_WrdPop (Vec_Wrd_t *p)
 
static int Vec_WrdFind (Vec_Wrd_t *p, word Entry)
 
static int Vec_WrdRemove (Vec_Wrd_t *p, word Entry)
 
static void Vec_WrdInsert (Vec_Wrd_t *p, int iHere, word Entry)
 
static word Vec_WrdFindMax (Vec_Wrd_t *p)
 
static word Vec_WrdFindMin (Vec_Wrd_t *p)
 
static void Vec_WrdReverseOrder (Vec_Wrd_t *p)
 
static Vec_Wrd_tVec_WrdInvert (Vec_Wrd_t *p, word Fill)
 
static word Vec_WrdSum (Vec_Wrd_t *p)
 
static int Vec_WrdEqual (Vec_Wrd_t *p1, Vec_Wrd_t *p2)
 
static int Vec_WrdCountCommon (Vec_Wrd_t *p1, Vec_Wrd_t *p2)
 
static int Vec_WrdSortCompare1 (word *pp1, word *pp2)
 
static int Vec_WrdSortCompare2 (word *pp1, word *pp2)
 
static void Vec_WrdSort (Vec_Wrd_t *p, int fReverse)
 
static void Vec_WrdUniqify (Vec_Wrd_t *p)
 
static int Vec_WrdUniqueCount (Vec_Wrd_t *vData, int nWordSize, Vec_Int_t **pvMap)
 
static Vec_Wrd_tVec_WrdUniqifyHash (Vec_Wrd_t *vData, int nWordSize)
 
static int Vec_WrdSortCompareUnsigned (word *pp1, word *pp2)
 
static void Vec_WrdSortUnsigned (Vec_Wrd_t *p)
 
static void Vec_WrdAppend (Vec_Wrd_t *vVec1, Vec_Wrd_t *vVec2)
 

Macro Definition Documentation

#define Vec_WrdForEachEntry (   vVec,
  Entry,
 
)    for ( i = 0; (i < Vec_WrdSize(vVec)) && (((Entry) = Vec_WrdEntry(vVec, i)), 1); i++ )

MACRO DEFINITIONS ///.

Definition at line 54 of file vecWrd.h.

#define Vec_WrdForEachEntryReverse (   vVec,
  pEntry,
 
)    for ( i = Vec_WrdSize(vVec) - 1; (i >= 0) && (((pEntry) = Vec_WrdEntry(vVec, i)), 1); i-- )

Definition at line 62 of file vecWrd.h.

#define Vec_WrdForEachEntryStart (   vVec,
  Entry,
  i,
  Start 
)    for ( i = Start; (i < Vec_WrdSize(vVec)) && (((Entry) = Vec_WrdEntry(vVec, i)), 1); i++ )

Definition at line 56 of file vecWrd.h.

#define Vec_WrdForEachEntryStartStop (   vVec,
  Entry,
  i,
  Start,
  Stop 
)    for ( i = Start; (i < Stop) && (((Entry) = Vec_WrdEntry(vVec, i)), 1); i++ )

Definition at line 60 of file vecWrd.h.

#define Vec_WrdForEachEntryStop (   vVec,
  Entry,
  i,
  Stop 
)    for ( i = 0; (i < Stop) && (((Entry) = Vec_WrdEntry(vVec, i)), 1); i++ )

Definition at line 58 of file vecWrd.h.

Typedef Documentation

typedef typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t

INCLUDES ///.

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

FileName [vecWrd.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Resizable arrays.]

Synopsis [Resizable arrays of long unsigned integers.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]PARAMETERS ///BASIC TYPES ///

Definition at line 42 of file vecWrd.h.

Function Documentation

static word Vec_WrdAddToEntry ( Vec_Wrd_t p,
int  i,
word  Addition 
)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 435 of file vecWrd.h.

436 {
437  assert( i >= 0 && i < p->nSize );
438  return p->pArray[i] += Addition;
439 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
static Vec_Wrd_t* Vec_WrdAlloc ( int  nCap)
inlinestatic

FUNCTION DEFINITIONS ///.

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

Synopsis [Allocates a vector with the given capacity.]

Description []

SideEffects []

SeeAlso []

Definition at line 80 of file vecWrd.h.

81 {
82  Vec_Wrd_t * p;
83  p = ABC_ALLOC( Vec_Wrd_t, 1 );
84  if ( nCap > 0 && nCap < 16 )
85  nCap = 16;
86  p->nSize = 0;
87  p->nCap = nCap;
88  p->pArray = p->nCap? ABC_ALLOC( word, p->nCap ) : NULL;
89  return p;
90 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.
Definition: vecWrd.h:42
static Vec_Wrd_t* Vec_WrdAllocArray ( word pArray,
int  nSize 
)
inlinestatic

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 165 of file vecWrd.h.

166 {
167  Vec_Wrd_t * p;
168  p = ABC_ALLOC( Vec_Wrd_t, 1 );
169  p->nSize = nSize;
170  p->nCap = nSize;
171  p->pArray = pArray;
172  return p;
173 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.
Definition: vecWrd.h:42
static Vec_Wrd_t* Vec_WrdAllocArrayCopy ( word pArray,
int  nSize 
)
inlinestatic

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 186 of file vecWrd.h.

187 {
188  Vec_Wrd_t * p;
189  p = ABC_ALLOC( Vec_Wrd_t, 1 );
190  p->nSize = nSize;
191  p->nCap = nSize;
192  p->pArray = ABC_ALLOC( word, nSize );
193  memcpy( p->pArray, pArray, sizeof(word) * nSize );
194  return p;
195 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
char * memcpy()
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.
Definition: vecWrd.h:42
static void Vec_WrdAppend ( Vec_Wrd_t vVec1,
Vec_Wrd_t vVec2 
)
inlinestatic

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

Synopsis [Appends the contents of the second vector.]

Description []

SideEffects []

SeeAlso []

Definition at line 1161 of file vecWrd.h.

1162 {
1163  word Entry; int i;
1164  Vec_WrdForEachEntry( vVec2, Entry, i )
1165  Vec_WrdPush( vVec1, Entry );
1166 }
static void Vec_WrdPush(Vec_Wrd_t *p, word Entry)
Definition: vecWrd.h:618
#define Vec_WrdForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecWrd.h:54
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static word* Vec_WrdArray ( Vec_Wrd_t p)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 316 of file vecWrd.h.

317 {
318  return p->pArray;
319 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_WrdCap ( Vec_Wrd_t p)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 352 of file vecWrd.h.

353 {
354  return p->nCap;
355 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_WrdClear ( Vec_Wrd_t p)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 602 of file vecWrd.h.

603 {
604  p->nSize = 0;
605 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_WrdCountCommon ( Vec_Wrd_t p1,
Vec_Wrd_t p2 
)
inlinestatic

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

Synopsis [Counts the number of common entries.]

Description []

SideEffects []

SeeAlso []

Definition at line 985 of file vecWrd.h.

986 {
987  Vec_Wrd_t * vTemp;
988  word Entry;
989  int i, Counter = 0;
990  if ( Vec_WrdSize(p1) < Vec_WrdSize(p2) )
991  vTemp = p1, p1 = p2, p2 = vTemp;
992  assert( Vec_WrdSize(p1) >= Vec_WrdSize(p2) );
993  vTemp = Vec_WrdInvert( p2, -1 );
994  Vec_WrdFillExtra( vTemp, Vec_WrdFindMax(p1) + 1, ~((word)0) );
995  Vec_WrdForEachEntry( p1, Entry, i )
996  if ( Vec_WrdEntry(vTemp, Entry) != ~((word)0) )
997  Counter++;
998  Vec_WrdFree( vTemp );
999  return Counter;
1000 }
static word Vec_WrdFindMax(Vec_Wrd_t *p)
Definition: vecWrd.h:849
static int Vec_WrdSize(Vec_Wrd_t *p)
Definition: vecWrd.h:336
#define Vec_WrdForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecWrd.h:54
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static Vec_Wrd_t * Vec_WrdInvert(Vec_Wrd_t *p, word Fill)
Definition: vecWrd.h:920
static void Vec_WrdFree(Vec_Wrd_t *p)
Definition: vecWrd.h:260
if(last==0)
Definition: sparse_int.h:34
static int Counter
static word Vec_WrdEntry(Vec_Wrd_t *p, int i)
Definition: vecWrd.h:384
#define assert(ex)
Definition: util_old.h:213
static void Vec_WrdFillExtra(Vec_Wrd_t *p, int nSize, word Fill)
Definition: vecWrd.h:509
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.
Definition: vecWrd.h:42
static Vec_Wrd_t* Vec_WrdDup ( Vec_Wrd_t pVec)
inlinestatic

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

Synopsis [Duplicates the integer array.]

Description []

SideEffects []

SeeAlso []

Definition at line 208 of file vecWrd.h.

209 {
210  Vec_Wrd_t * p;
211  p = ABC_ALLOC( Vec_Wrd_t, 1 );
212  p->nSize = pVec->nSize;
213  p->nCap = pVec->nSize;
214  p->pArray = p->nCap? ABC_ALLOC( word, p->nCap ) : NULL;
215  memcpy( p->pArray, pVec->pArray, sizeof(word) * pVec->nSize );
216  return p;
217 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
char * memcpy()
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.
Definition: vecWrd.h:42
static Vec_Wrd_t* Vec_WrdDupArray ( Vec_Wrd_t pVec)
inlinestatic

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

Synopsis [Transfers the array into another vector.]

Description []

SideEffects []

SeeAlso []

Definition at line 230 of file vecWrd.h.

231 {
232  Vec_Wrd_t * p;
233  p = ABC_ALLOC( Vec_Wrd_t, 1 );
234  p->nSize = pVec->nSize;
235  p->nCap = pVec->nCap;
236  p->pArray = pVec->pArray;
237  pVec->nSize = 0;
238  pVec->nCap = 0;
239  pVec->pArray = NULL;
240  return p;
241 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.
Definition: vecWrd.h:42
static word Vec_WrdEntry ( Vec_Wrd_t p,
int  i 
)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 384 of file vecWrd.h.

385 {
386  assert( i >= 0 && i < p->nSize );
387  return p->pArray[i];
388 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
static word Vec_WrdEntryLast ( Vec_Wrd_t p)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 452 of file vecWrd.h.

453 {
454  assert( p->nSize > 0 );
455  return p->pArray[p->nSize-1];
456 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
static word* Vec_WrdEntryP ( Vec_Wrd_t p,
int  i 
)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 401 of file vecWrd.h.

402 {
403  assert( i >= 0 && i < p->nSize );
404  return p->pArray + i;
405 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
static int Vec_WrdEqual ( Vec_Wrd_t p1,
Vec_Wrd_t p2 
)
inlinestatic

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

Synopsis [Checks if two vectors are equal.]

Description []

SideEffects []

SeeAlso []

Definition at line 963 of file vecWrd.h.

964 {
965  int i;
966  if ( p1->nSize != p2->nSize )
967  return 0;
968  for ( i = 0; i < p1->nSize; i++ )
969  if ( p1->pArray[i] != p2->pArray[i] )
970  return 0;
971  return 1;
972 }
static void Vec_WrdErase ( Vec_Wrd_t p)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 254 of file vecWrd.h.

255 {
256  ABC_FREE( p->pArray );
257  p->nSize = 0;
258  p->nCap = 0;
259 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_FREE(obj)
Definition: abc_global.h:232
static word* Vec_WrdFetch ( Vec_Wrd_t p,
int  nWords 
)
inlinestatic

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

Synopsis [Returns the pointer to the next nWords entries in the vector.]

Description []

SideEffects []

SeeAlso []

Definition at line 740 of file vecWrd.h.

741 {
742  if ( nWords == 0 )
743  return NULL;
744  assert( nWords > 0 );
745  p->nSize += nWords;
746  if ( p->nSize > p->nCap )
747  {
748 // Vec_WrdGrow( p, 2 * p->nSize );
749  return NULL;
750  }
751  return p->pArray + p->nSize - nWords;
752 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nWords
Definition: abcNpn.c:127
#define assert(ex)
Definition: util_old.h:213
static void Vec_WrdFill ( Vec_Wrd_t p,
int  nSize,
word  Fill 
)
inlinestatic

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 489 of file vecWrd.h.

490 {
491  int i;
492  Vec_WrdGrow( p, nSize );
493  for ( i = 0; i < nSize; i++ )
494  p->pArray[i] = Fill;
495  p->nSize = nSize;
496 }
static void Vec_WrdGrow(Vec_Wrd_t *p, int nCapMin)
Definition: vecWrd.h:469
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_WrdFillExtra ( Vec_Wrd_t p,
int  nSize,
word  Fill 
)
inlinestatic

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 509 of file vecWrd.h.

510 {
511  int i;
512  if ( nSize <= p->nSize )
513  return;
514  if ( nSize > 2 * p->nCap )
515  Vec_WrdGrow( p, nSize );
516  else if ( nSize > p->nCap )
517  Vec_WrdGrow( p, 2 * p->nCap );
518  for ( i = p->nSize; i < nSize; i++ )
519  p->pArray[i] = Fill;
520  p->nSize = nSize;
521 }
static void Vec_WrdGrow(Vec_Wrd_t *p, int nCapMin)
Definition: vecWrd.h:469
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_WrdFind ( Vec_Wrd_t p,
word  Entry 
)
inlinestatic

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

Synopsis [Find entry.]

Description []

SideEffects []

SeeAlso []

Definition at line 782 of file vecWrd.h.

783 {
784  int i;
785  for ( i = 0; i < p->nSize; i++ )
786  if ( p->pArray[i] == Entry )
787  return i;
788  return -1;
789 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static word Vec_WrdFindMax ( Vec_Wrd_t p)
inlinestatic

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

Synopsis [Find entry.]

Description []

SideEffects []

SeeAlso []

Definition at line 849 of file vecWrd.h.

850 {
851  word Best;
852  int i;
853  if ( p->nSize == 0 )
854  return 0;
855  Best = p->pArray[0];
856  for ( i = 1; i < p->nSize; i++ )
857  if ( Best < p->pArray[i] )
858  Best = p->pArray[i];
859  return Best;
860 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static word Vec_WrdFindMin ( Vec_Wrd_t p)
inlinestatic

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

Synopsis [Find entry.]

Description []

SideEffects []

SeeAlso []

Definition at line 873 of file vecWrd.h.

874 {
875  word Best;
876  int i;
877  if ( p->nSize == 0 )
878  return 0;
879  Best = p->pArray[0];
880  for ( i = 1; i < p->nSize; i++ )
881  if ( Best > p->pArray[i] )
882  Best = p->pArray[i];
883  return Best;
884 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static void Vec_WrdFree ( Vec_Wrd_t p)
inlinestatic

Definition at line 260 of file vecWrd.h.

261 {
262  ABC_FREE( p->pArray );
263  ABC_FREE( p );
264 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_FREE(obj)
Definition: abc_global.h:232
static void Vec_WrdFreeP ( Vec_Wrd_t **  p)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 277 of file vecWrd.h.

278 {
279  if ( *p == NULL )
280  return;
281  ABC_FREE( (*p)->pArray );
282  ABC_FREE( (*p) );
283 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_FREE(obj)
Definition: abc_global.h:232
static word Vec_WrdGetEntry ( Vec_Wrd_t p,
int  i 
)
inlinestatic

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 534 of file vecWrd.h.

535 {
536  Vec_WrdFillExtra( p, i + 1, 0 );
537  return Vec_WrdEntry( p, i );
538 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static word Vec_WrdEntry(Vec_Wrd_t *p, int i)
Definition: vecWrd.h:384
static void Vec_WrdFillExtra(Vec_Wrd_t *p, int nSize, word Fill)
Definition: vecWrd.h:509
static word* Vec_WrdGetEntryP ( Vec_Wrd_t p,
int  i 
)
inlinestatic

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 551 of file vecWrd.h.

552 {
553  Vec_WrdFillExtra( p, i + 1, 0 );
554  return Vec_WrdEntryP( p, i );
555 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_WrdFillExtra(Vec_Wrd_t *p, int nSize, word Fill)
Definition: vecWrd.h:509
static word * Vec_WrdEntryP(Vec_Wrd_t *p, int i)
Definition: vecWrd.h:401
static void Vec_WrdGrow ( Vec_Wrd_t p,
int  nCapMin 
)
inlinestatic

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

Synopsis [Resizes the vector to the given capacity.]

Description []

SideEffects []

SeeAlso []

Definition at line 469 of file vecWrd.h.

470 {
471  if ( p->nCap >= nCapMin )
472  return;
473  p->pArray = ABC_REALLOC( word, p->pArray, nCapMin );
474  assert( p->pArray );
475  p->nCap = nCapMin;
476 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_REALLOC(type, obj, num)
Definition: abc_global.h:233
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
#define assert(ex)
Definition: util_old.h:213
static void Vec_WrdInsert ( Vec_Wrd_t p,
int  iHere,
word  Entry 
)
inlinestatic

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 828 of file vecWrd.h.

829 {
830  int i;
831  assert( iHere >= 0 && iHere < p->nSize );
832  Vec_WrdPush( p, 0 );
833  for ( i = p->nSize - 1; i > iHere; i-- )
834  p->pArray[i] = p->pArray[i-1];
835  p->pArray[i] = Entry;
836 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_WrdPush(Vec_Wrd_t *p, word Entry)
Definition: vecWrd.h:618
#define assert(ex)
Definition: util_old.h:213
static Vec_Wrd_t* Vec_WrdInvert ( Vec_Wrd_t p,
word  Fill 
)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 920 of file vecWrd.h.

921 {
922  int i;
923  word Entry;
924  Vec_Wrd_t * vRes = Vec_WrdAlloc( 0 );
925  Vec_WrdFill( vRes, Vec_WrdFindMax(p) + 1, Fill );
926  Vec_WrdForEachEntry( p, Entry, i )
927  if ( Entry != Fill )
928  Vec_WrdWriteEntry( vRes, Entry, i );
929  return vRes;
930 }
static word Vec_WrdFindMax(Vec_Wrd_t *p)
Definition: vecWrd.h:849
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Vec_WrdForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecWrd.h:54
static void Vec_WrdWriteEntry(Vec_Wrd_t *p, int i, word Entry)
Definition: vecWrd.h:418
static void Vec_WrdFill(Vec_Wrd_t *p, int nSize, word Fill)
Definition: vecWrd.h:489
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
if(last==0)
Definition: sparse_int.h:34
static Vec_Wrd_t * Vec_WrdAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecWrd.h:80
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.
Definition: vecWrd.h:42
static word* Vec_WrdLimit ( Vec_Wrd_t p)
inlinestatic

Definition at line 320 of file vecWrd.h.

321 {
322  return p->pArray + p->nSize;
323 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static double Vec_WrdMemory ( Vec_Wrd_t p)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 368 of file vecWrd.h.

369 {
370  return !p ? 0.0 : 1.0 * sizeof(word) * p->nCap + sizeof(Vec_Wrd_t);
371 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.
Definition: vecWrd.h:42
static word Vec_WrdPop ( Vec_Wrd_t p)
inlinestatic

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 765 of file vecWrd.h.

766 {
767  assert( p->nSize > 0 );
768  return p->pArray[--p->nSize];
769 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
static void Vec_WrdPush ( Vec_Wrd_t p,
word  Entry 
)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 618 of file vecWrd.h.

619 {
620  if ( p->nSize == p->nCap )
621  {
622  if ( p->nCap < 16 )
623  Vec_WrdGrow( p, 16 );
624  else
625  Vec_WrdGrow( p, 2 * p->nCap );
626  }
627  p->pArray[p->nSize++] = Entry;
628 }
static void Vec_WrdGrow(Vec_Wrd_t *p, int nCapMin)
Definition: vecWrd.h:469
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_WrdPushFirst ( Vec_Wrd_t p,
word  Entry 
)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 641 of file vecWrd.h.

642 {
643  int i;
644  if ( p->nSize == p->nCap )
645  {
646  if ( p->nCap < 16 )
647  Vec_WrdGrow( p, 16 );
648  else
649  Vec_WrdGrow( p, 2 * p->nCap );
650  }
651  p->nSize++;
652  for ( i = p->nSize - 1; i >= 1; i-- )
653  p->pArray[i] = p->pArray[i-1];
654  p->pArray[0] = Entry;
655 }
static void Vec_WrdGrow(Vec_Wrd_t *p, int nCapMin)
Definition: vecWrd.h:469
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_WrdPushOrder ( Vec_Wrd_t p,
word  Entry 
)
inlinestatic

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

Synopsis [Inserts the entry while preserving the increasing order.]

Description []

SideEffects []

SeeAlso []

Definition at line 668 of file vecWrd.h.

669 {
670  int i;
671  if ( p->nSize == p->nCap )
672  {
673  if ( p->nCap < 16 )
674  Vec_WrdGrow( p, 16 );
675  else
676  Vec_WrdGrow( p, 2 * p->nCap );
677  }
678  p->nSize++;
679  for ( i = p->nSize-2; i >= 0; i-- )
680  if ( p->pArray[i] > Entry )
681  p->pArray[i+1] = p->pArray[i];
682  else
683  break;
684  p->pArray[i+1] = Entry;
685 }
static void Vec_WrdGrow(Vec_Wrd_t *p, int nCapMin)
Definition: vecWrd.h:469
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_WrdPushUnique ( Vec_Wrd_t p,
word  Entry 
)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 719 of file vecWrd.h.

720 {
721  int i;
722  for ( i = 0; i < p->nSize; i++ )
723  if ( p->pArray[i] == Entry )
724  return 1;
725  Vec_WrdPush( p, Entry );
726  return 0;
727 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_WrdPush(Vec_Wrd_t *p, word Entry)
Definition: vecWrd.h:618
static int Vec_WrdPushUniqueOrder ( Vec_Wrd_t p,
word  Entry 
)
inlinestatic

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

Synopsis [Inserts the entry while preserving the increasing order.]

Description []

SideEffects []

SeeAlso []

Definition at line 698 of file vecWrd.h.

699 {
700  int i;
701  for ( i = 0; i < p->nSize; i++ )
702  if ( p->pArray[i] == Entry )
703  return 1;
704  Vec_WrdPushOrder( p, Entry );
705  return 0;
706 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_WrdPushOrder(Vec_Wrd_t *p, word Entry)
Definition: vecWrd.h:668
static word* Vec_WrdReleaseArray ( Vec_Wrd_t p)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 296 of file vecWrd.h.

297 {
298  word * pArray = p->pArray;
299  p->nCap = 0;
300  p->nSize = 0;
301  p->pArray = NULL;
302  return pArray;
303 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static int Vec_WrdRemove ( Vec_Wrd_t p,
word  Entry 
)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 802 of file vecWrd.h.

803 {
804  int i;
805  for ( i = 0; i < p->nSize; i++ )
806  if ( p->pArray[i] == Entry )
807  break;
808  if ( i == p->nSize )
809  return 0;
810  assert( i < p->nSize );
811  for ( i++; i < p->nSize; i++ )
812  p->pArray[i-1] = p->pArray[i];
813  p->nSize--;
814  return 1;
815 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
static void Vec_WrdReverseOrder ( Vec_Wrd_t p)
inlinestatic

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

Synopsis [Reverses the order of entries.]

Description []

SideEffects []

SeeAlso []

Definition at line 897 of file vecWrd.h.

898 {
899  word Temp;
900  int i;
901  for ( i = 0; i < p->nSize/2; i++ )
902  {
903  Temp = p->pArray[i];
904  p->pArray[i] = p->pArray[p->nSize-1-i];
905  p->pArray[p->nSize-1-i] = Temp;
906  }
907 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static void Vec_WrdSetEntry ( Vec_Wrd_t p,
int  i,
word  Entry 
)
inlinestatic

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 568 of file vecWrd.h.

569 {
570  Vec_WrdFillExtra( p, i + 1, 0 );
571  Vec_WrdWriteEntry( p, i, Entry );
572 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_WrdWriteEntry(Vec_Wrd_t *p, int i, word Entry)
Definition: vecWrd.h:418
static void Vec_WrdFillExtra(Vec_Wrd_t *p, int nSize, word Fill)
Definition: vecWrd.h:509
static void Vec_WrdShrink ( Vec_Wrd_t p,
int  nSizeNew 
)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 585 of file vecWrd.h.

586 {
587  assert( p->nSize >= nSizeNew );
588  p->nSize = nSizeNew;
589 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
static int Vec_WrdSize ( Vec_Wrd_t p)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 336 of file vecWrd.h.

337 {
338  return p->nSize;
339 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_WrdSort ( Vec_Wrd_t p,
int  fReverse 
)
inlinestatic

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

Synopsis [Sorting the entries by their integer value.]

Description []

SideEffects []

SeeAlso []

Definition at line 1055 of file vecWrd.h.

1056 {
1057  if ( fReverse )
1058  qsort( (void *)p->pArray, p->nSize, sizeof(word),
1059  (int (*)(const void *, const void *)) Vec_WrdSortCompare2 );
1060  else
1061  qsort( (void *)p->pArray, p->nSize, sizeof(word),
1062  (int (*)(const void *, const void *)) Vec_WrdSortCompare1 );
1063 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_WrdSortCompare1(word *pp1, word *pp2)
Definition: vecWrd.h:1013
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static int Vec_WrdSortCompare2(word *pp1, word *pp2)
Definition: vecWrd.h:1034
static int Vec_WrdSortCompare1 ( word pp1,
word pp2 
)
static

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

Synopsis [Comparison procedure for two integers.]

Description []

SideEffects []

SeeAlso []

Definition at line 1013 of file vecWrd.h.

1014 {
1015  // for some reason commenting out lines (as shown) led to crashing of the release version
1016  if ( *pp1 < *pp2 )
1017  return -1;
1018  if ( *pp1 > *pp2 ) //
1019  return 1;
1020  return 0; //
1021 }
static int Vec_WrdSortCompare2 ( word pp1,
word pp2 
)
static

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

Synopsis [Comparison procedure for two integers.]

Description []

SideEffects []

SeeAlso []

Definition at line 1034 of file vecWrd.h.

1035 {
1036  // for some reason commenting out lines (as shown) led to crashing of the release version
1037  if ( *pp1 > *pp2 )
1038  return -1;
1039  if ( *pp1 < *pp2 ) //
1040  return 1;
1041  return 0; //
1042 }
static int Vec_WrdSortCompareUnsigned ( word pp1,
word pp2 
)
static

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

Synopsis [Comparison procedure for two integers.]

Description []

SideEffects []

SeeAlso []

Definition at line 1123 of file vecWrd.h.

1124 {
1125  if ( *pp1 < *pp2 )
1126  return -1;
1127  if ( *pp1 > *pp2 )
1128  return 1;
1129  return 0;
1130 }
static void Vec_WrdSortUnsigned ( Vec_Wrd_t p)
inlinestatic

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

Synopsis [Sorting the entries by their integer value.]

Description []

SideEffects []

SeeAlso []

Definition at line 1143 of file vecWrd.h.

1144 {
1145  qsort( (void *)p->pArray, p->nSize, sizeof(word),
1146  (int (*)(const void *, const void *)) Vec_WrdSortCompareUnsigned );
1147 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_WrdSortCompareUnsigned(word *pp1, word *pp2)
Definition: vecWrd.h:1123
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static Vec_Wrd_t* Vec_WrdStart ( int  nSize)
inlinestatic

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 103 of file vecWrd.h.

104 {
105  Vec_Wrd_t * p;
106  p = Vec_WrdAlloc( nSize );
107  p->nSize = nSize;
108  memset( p->pArray, 0, sizeof(word) * nSize );
109  return p;
110 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static Vec_Wrd_t * Vec_WrdAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecWrd.h:80
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.
Definition: vecWrd.h:42
static Vec_Wrd_t* Vec_WrdStartFull ( int  nSize)
inlinestatic

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 123 of file vecWrd.h.

124 {
125  Vec_Wrd_t * p;
126  p = Vec_WrdAlloc( nSize );
127  p->nSize = nSize;
128  memset( p->pArray, 0xff, sizeof(word) * nSize );
129  return p;
130 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static Vec_Wrd_t * Vec_WrdAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecWrd.h:80
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.
Definition: vecWrd.h:42
static Vec_Wrd_t* Vec_WrdStartNatural ( int  nSize)
inlinestatic

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 143 of file vecWrd.h.

144 {
145  Vec_Wrd_t * p;
146  int i;
147  p = Vec_WrdAlloc( nSize );
148  p->nSize = nSize;
149  for ( i = 0; i < nSize; i++ )
150  p->pArray[i] = i;
151  return p;
152 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Vec_Wrd_t * Vec_WrdAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecWrd.h:80
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.
Definition: vecWrd.h:42
static word Vec_WrdSum ( Vec_Wrd_t p)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 943 of file vecWrd.h.

944 {
945  word Counter = 0;
946  int i;
947  for ( i = 0; i < p->nSize; i++ )
948  Counter += p->pArray[i];
949  return Counter;
950 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static int Counter
static void Vec_WrdUniqify ( Vec_Wrd_t p)
inlinestatic

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

Synopsis [Leaves only unique entries.]

Description []

SideEffects []

SeeAlso []

Definition at line 1076 of file vecWrd.h.

1077 {
1078  int i, k;
1079  if ( p->nSize < 2 )
1080  return;
1081  Vec_WrdSort( p, 0 );
1082  for ( i = k = 1; i < p->nSize; i++ )
1083  if ( p->pArray[i] != p->pArray[i-1] )
1084  p->pArray[k++] = p->pArray[i];
1085  p->nSize = k;
1086 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_WrdSort(Vec_Wrd_t *p, int fReverse)
Definition: vecWrd.h:1055
static Vec_Wrd_t* Vec_WrdUniqifyHash ( Vec_Wrd_t vData,
int  nWordSize 
)
inlinestatic

Definition at line 1098 of file vecWrd.h.

1099 {
1100  Vec_Int_t * vResInt;
1101  Vec_Int_t * vDataInt = (Vec_Int_t *)vData;
1102  vDataInt->nSize *= 2;
1103  vDataInt->nCap *= 2;
1104  vResInt = Vec_IntUniqifyHash( vDataInt, 2 * nWordSize );
1105  vDataInt->nSize /= 2;
1106  vDataInt->nCap /= 2;
1107  vResInt->nSize /= 2;
1108  vResInt->nCap /= 2;
1109  return (Vec_Wrd_t *)vResInt;
1110 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Vec_Int_t * Vec_IntUniqifyHash(Vec_Int_t *vData, int nIntSize)
Definition: vecInt.h:1464
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.
Definition: vecWrd.h:42
static int Vec_WrdUniqueCount ( Vec_Wrd_t vData,
int  nWordSize,
Vec_Int_t **  pvMap 
)
inlinestatic

Definition at line 1087 of file vecWrd.h.

1088 {
1089  int Result;
1090  Vec_Int_t * vDataInt = (Vec_Int_t *)vData;
1091  vDataInt->nSize *= 2;
1092  vDataInt->nCap *= 2;
1093  Result = Vec_IntUniqueCount( vDataInt, 2 * nWordSize, pvMap );
1094  vDataInt->nSize /= 2;
1095  vDataInt->nCap /= 2;
1096  return Result;
1097 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Vec_IntUniqueCount(Vec_Int_t *vData, int nIntSize, Vec_Int_t **pvMap)
Definition: vecInt.h:1437
static void Vec_WrdWriteEntry ( Vec_Wrd_t p,
int  i,
word  Entry 
)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 418 of file vecWrd.h.

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