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

Go to the source code of this file.

Data Structures

struct  Vec_Int_t_
 

Macros

#define Vec_IntForEachEntry(vVec, Entry, i)   for ( i = 0; (i < Vec_IntSize(vVec)) && (((Entry) = Vec_IntEntry(vVec, i)), 1); i++ )
 MACRO DEFINITIONS ///. More...
 
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)   for ( i = Start; (i < Vec_IntSize(vVec)) && (((Entry) = Vec_IntEntry(vVec, i)), 1); i++ )
 
#define Vec_IntForEachEntryStop(vVec, Entry, i, Stop)   for ( i = 0; (i < Stop) && (((Entry) = Vec_IntEntry(vVec, i)), 1); i++ )
 
#define Vec_IntForEachEntryStartStop(vVec, Entry, i, Start, Stop)   for ( i = Start; (i < Stop) && (((Entry) = Vec_IntEntry(vVec, i)), 1); i++ )
 
#define Vec_IntForEachEntryReverse(vVec, pEntry, i)   for ( i = Vec_IntSize(vVec) - 1; (i >= 0) && (((pEntry) = Vec_IntEntry(vVec, i)), 1); i-- )
 
#define Vec_IntForEachEntryTwo(vVec1, vVec2, Entry1, Entry2, i)   for ( i = 0; (i < Vec_IntSize(vVec1)) && (((Entry1) = Vec_IntEntry(vVec1, i)), 1) && (((Entry2) = Vec_IntEntry(vVec2, i)), 1); i++ )
 
#define Vec_IntForEachEntryDouble(vVec, Entry1, Entry2, i)   for ( i = 0; (i+1 < Vec_IntSize(vVec)) && (((Entry1) = Vec_IntEntry(vVec, i)), 1) && (((Entry2) = Vec_IntEntry(vVec, i+1)), 1); i += 2 )
 
#define Vec_IntForEachEntryTriple(vVec, Entry1, Entry2, Entry3, i)   for ( i = 0; (i+2 < Vec_IntSize(vVec)) && (((Entry1) = Vec_IntEntry(vVec, i)), 1) && (((Entry2) = Vec_IntEntry(vVec, i+1)), 1) && (((Entry3) = Vec_IntEntry(vVec, i+2)), 1); i += 3 )
 
#define Vec_IntForEachEntryThisNext(vVec, This, Next, i)   for ( i = 0, (This) = (Next) = (Vec_IntSize(vVec) ? Vec_IntEntry(vVec, 0) : -1); (i+1 < Vec_IntSize(vVec)) && (((Next) = Vec_IntEntry(vVec, i+1)), 1); i += 2, (This) = (Next) )
 

Typedefs

typedef
typedefABC_NAMESPACE_HEADER_START
struct Vec_Int_t_ 
Vec_Int_t
 INCLUDES ///. More...
 

Functions

static Vec_Int_tVec_IntAlloc (int nCap)
 FUNCTION DEFINITIONS ///. More...
 
static Vec_Int_tVec_IntStart (int nSize)
 
static Vec_Int_tVec_IntStartFull (int nSize)
 
static Vec_Int_tVec_IntStartRange (int First, int Range)
 
static Vec_Int_tVec_IntStartNatural (int nSize)
 
static Vec_Int_tVec_IntAllocArray (int *pArray, int nSize)
 
static Vec_Int_tVec_IntAllocArrayCopy (int *pArray, int nSize)
 
static Vec_Int_tVec_IntDup (Vec_Int_t *pVec)
 
static Vec_Int_tVec_IntDupArray (Vec_Int_t *pVec)
 
static void Vec_IntZero (Vec_Int_t *p)
 
static void Vec_IntErase (Vec_Int_t *p)
 
static void Vec_IntFree (Vec_Int_t *p)
 
static void Vec_IntFreeP (Vec_Int_t **p)
 
static int * Vec_IntReleaseArray (Vec_Int_t *p)
 
static int * Vec_IntArray (Vec_Int_t *p)
 
static int ** Vec_IntArrayP (Vec_Int_t *p)
 
static int * Vec_IntLimit (Vec_Int_t *p)
 
static int Vec_IntSize (Vec_Int_t *p)
 
static int Vec_IntCap (Vec_Int_t *p)
 
static double Vec_IntMemory (Vec_Int_t *p)
 
static int Vec_IntEntry (Vec_Int_t *p, int i)
 
static int * Vec_IntEntryP (Vec_Int_t *p, int i)
 
static void Vec_IntWriteEntry (Vec_Int_t *p, int i, int Entry)
 
static int Vec_IntAddToEntry (Vec_Int_t *p, int i, int Addition)
 
static void Vec_IntUpdateEntry (Vec_Int_t *p, int i, int Value)
 
static void Vec_IntDowndateEntry (Vec_Int_t *p, int i, int Value)
 
static int Vec_IntEntryLast (Vec_Int_t *p)
 
static void Vec_IntGrow (Vec_Int_t *p, int nCapMin)
 
static void Vec_IntGrowResize (Vec_Int_t *p, int nCapMin)
 
static void Vec_IntFill (Vec_Int_t *p, int nSize, int Fill)
 
static void Vec_IntFillTwo (Vec_Int_t *p, int nSize, int FillEven, int FillOdd)
 
static void Vec_IntFillExtra (Vec_Int_t *p, int nSize, int Fill)
 
static int Vec_IntGetEntry (Vec_Int_t *p, int i)
 
static int * Vec_IntGetEntryP (Vec_Int_t *p, int i)
 
static void Vec_IntSetEntry (Vec_Int_t *p, int i, int Entry)
 
static void Vec_IntSetEntryFull (Vec_Int_t *p, int i, int Entry)
 
static void Vec_IntShrink (Vec_Int_t *p, int nSizeNew)
 
static void Vec_IntClear (Vec_Int_t *p)
 
static void Vec_IntPush (Vec_Int_t *p, int Entry)
 
static void Vec_IntPushTwo (Vec_Int_t *p, int Entry1, int Entry2)
 
static void Vec_IntPushArray (Vec_Int_t *p, int *pEntries, int nEntries)
 
static void Vec_IntPushFirst (Vec_Int_t *p, int Entry)
 
static void Vec_IntPushOrder (Vec_Int_t *p, int Entry)
 
static void Vec_IntPushOrderReverse (Vec_Int_t *p, int Entry)
 
static int Vec_IntPushUniqueOrder (Vec_Int_t *p, int Entry)
 
static int Vec_IntPushUnique (Vec_Int_t *p, int Entry)
 
static unsigned * Vec_IntFetch (Vec_Int_t *p, int nWords)
 
static int Vec_IntPop (Vec_Int_t *p)
 
static int Vec_IntFind (Vec_Int_t *p, int Entry)
 
static int Vec_IntRemove (Vec_Int_t *p, int Entry)
 
static int Vec_IntRemove1 (Vec_Int_t *p, int Entry)
 
static void Vec_IntDrop (Vec_Int_t *p, int i)
 
static void Vec_IntInsert (Vec_Int_t *p, int iHere, int Entry)
 
static int Vec_IntFindMax (Vec_Int_t *p)
 
static int Vec_IntFindMin (Vec_Int_t *p)
 
static void Vec_IntReverseOrder (Vec_Int_t *p)
 
static void Vec_IntRemoveOdd (Vec_Int_t *p)
 
static void Vec_IntRemoveEven (Vec_Int_t *p)
 
static Vec_Int_tVec_IntInvert (Vec_Int_t *p, int Fill)
 
static Vec_Int_tVec_IntCondense (Vec_Int_t *p, int Fill)
 
static int Vec_IntSum (Vec_Int_t *p)
 
static int Vec_IntCountEntry (Vec_Int_t *p, int Entry)
 
static int Vec_IntCountPositive (Vec_Int_t *p)
 
static int Vec_IntCountZero (Vec_Int_t *p)
 
static int Vec_IntEqual (Vec_Int_t *p1, Vec_Int_t *p2)
 
static int Vec_IntCountCommon (Vec_Int_t *p1, Vec_Int_t *p2)
 
static int Vec_IntSortCompare1 (int *pp1, int *pp2)
 
static int Vec_IntSortCompare2 (int *pp1, int *pp2)
 
static void Vec_IntSort (Vec_Int_t *p, int fReverse)
 
static int Vec_IntUniqify (Vec_Int_t *p)
 
static int Vec_IntCountDuplicates (Vec_Int_t *p)
 
static int Vec_IntCheckUniqueSmall (Vec_Int_t *p)
 
static int Vec_IntCountUnique (Vec_Int_t *p)
 
static unsigned Vec_IntUniqueHashKeyDebug (unsigned char *pStr, int nChars, int TableMask)
 
static void Vec_IntUniqueProfile (Vec_Int_t *vData, int *pTable, int *pNexts, int TableMask, int nIntSize)
 
static unsigned Vec_IntUniqueHashKey2 (unsigned char *pStr, int nChars)
 
static unsigned Vec_IntUniqueHashKey (unsigned char *pStr, int nChars)
 
static int * Vec_IntUniqueLookup (Vec_Int_t *vData, int i, int nIntSize, int *pNexts, int *pStart)
 
static int Vec_IntUniqueCount (Vec_Int_t *vData, int nIntSize, Vec_Int_t **pvMap)
 
static Vec_Int_tVec_IntUniqifyHash (Vec_Int_t *vData, int nIntSize)
 
static int Vec_IntSortCompareUnsigned (unsigned *pp1, unsigned *pp2)
 
static void Vec_IntSortUnsigned (Vec_Int_t *p)
 
static int Vec_IntTwoCountCommon (Vec_Int_t *vArr1, Vec_Int_t *vArr2)
 
static int Vec_IntTwoFindCommon (Vec_Int_t *vArr1, Vec_Int_t *vArr2, Vec_Int_t *vArr)
 
static int Vec_IntTwoRemoveCommon (Vec_Int_t *vArr1, Vec_Int_t *vArr2, Vec_Int_t *vArr)
 
static int Vec_IntTwoRemove (Vec_Int_t *vArr1, Vec_Int_t *vArr2)
 
static void Vec_IntTwoMerge2Int (Vec_Int_t *vArr1, Vec_Int_t *vArr2, Vec_Int_t *vArr)
 
static Vec_Int_tVec_IntTwoMerge (Vec_Int_t *vArr1, Vec_Int_t *vArr2)
 
static void Vec_IntTwoMerge2 (Vec_Int_t *vArr1, Vec_Int_t *vArr2, Vec_Int_t *vArr)
 
static void Vec_IntTwoSplit (Vec_Int_t *vArr1, Vec_Int_t *vArr2, Vec_Int_t *vArr, Vec_Int_t *vArr1n, Vec_Int_t *vArr2n)
 
static void Vec_IntSelectSort (int *pArray, int nSize)
 
static void Vec_IntSelectSortCost (int *pArray, int nSize, Vec_Int_t *vCosts)
 
static void Vec_IntSelectSortCost2 (int *pArray, int nSize, int *pCosts)
 
static void Vec_IntPrint (Vec_Int_t *vVec)
 
static void Vec_IntPrintBinary (Vec_Int_t *vVec)
 
static int Vec_IntCompareVec (Vec_Int_t *p1, Vec_Int_t *p2)
 
static void Vec_IntAppend (Vec_Int_t *vVec1, Vec_Int_t *vVec2)
 

Macro Definition Documentation

#define Vec_IntForEachEntry (   vVec,
  Entry,
 
)    for ( i = 0; (i < Vec_IntSize(vVec)) && (((Entry) = Vec_IntEntry(vVec, i)), 1); i++ )

MACRO DEFINITIONS ///.

Definition at line 54 of file vecInt.h.

#define Vec_IntForEachEntryDouble (   vVec,
  Entry1,
  Entry2,
 
)    for ( i = 0; (i+1 < Vec_IntSize(vVec)) && (((Entry1) = Vec_IntEntry(vVec, i)), 1) && (((Entry2) = Vec_IntEntry(vVec, i+1)), 1); i += 2 )

Definition at line 66 of file vecInt.h.

#define Vec_IntForEachEntryReverse (   vVec,
  pEntry,
 
)    for ( i = Vec_IntSize(vVec) - 1; (i >= 0) && (((pEntry) = Vec_IntEntry(vVec, i)), 1); i-- )

Definition at line 62 of file vecInt.h.

#define Vec_IntForEachEntryStart (   vVec,
  Entry,
  i,
  Start 
)    for ( i = Start; (i < Vec_IntSize(vVec)) && (((Entry) = Vec_IntEntry(vVec, i)), 1); i++ )

Definition at line 56 of file vecInt.h.

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

Definition at line 60 of file vecInt.h.

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

Definition at line 58 of file vecInt.h.

#define Vec_IntForEachEntryThisNext (   vVec,
  This,
  Next,
 
)    for ( i = 0, (This) = (Next) = (Vec_IntSize(vVec) ? Vec_IntEntry(vVec, 0) : -1); (i+1 < Vec_IntSize(vVec)) && (((Next) = Vec_IntEntry(vVec, i+1)), 1); i += 2, (This) = (Next) )

Definition at line 70 of file vecInt.h.

#define Vec_IntForEachEntryTriple (   vVec,
  Entry1,
  Entry2,
  Entry3,
 
)    for ( i = 0; (i+2 < Vec_IntSize(vVec)) && (((Entry1) = Vec_IntEntry(vVec, i)), 1) && (((Entry2) = Vec_IntEntry(vVec, i+1)), 1) && (((Entry3) = Vec_IntEntry(vVec, i+2)), 1); i += 3 )

Definition at line 68 of file vecInt.h.

#define Vec_IntForEachEntryTwo (   vVec1,
  vVec2,
  Entry1,
  Entry2,
 
)    for ( i = 0; (i < Vec_IntSize(vVec1)) && (((Entry1) = Vec_IntEntry(vVec1, i)), 1) && (((Entry2) = Vec_IntEntry(vVec2, i)), 1); i++ )

Definition at line 64 of file vecInt.h.

Typedef Documentation

typedef typedefABC_NAMESPACE_HEADER_START struct Vec_Int_t_ Vec_Int_t

INCLUDES ///.

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

FileName [vecInt.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Resizable arrays.]

Synopsis [Resizable arrays of integers.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]PARAMETERS ///BASIC TYPES ///

Definition at line 42 of file vecInt.h.

Function Documentation

static int Vec_IntAddToEntry ( Vec_Int_t p,
int  i,
int  Addition 
)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 451 of file vecInt.h.

452 {
453  assert( i >= 0 && i < p->nSize );
454  return p->pArray[i] += Addition;
455 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
static Vec_Int_t* Vec_IntAlloc ( int  nCap)
inlinestatic

FUNCTION DEFINITIONS ///.

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

Synopsis [Allocates a vector with the given capacity.]

Description []

SideEffects []

SeeAlso []

Definition at line 88 of file vecInt.h.

89 {
90  Vec_Int_t * p;
91  p = ABC_ALLOC( Vec_Int_t, 1 );
92  if ( nCap > 0 && nCap < 16 )
93  nCap = 16;
94  p->nSize = 0;
95  p->nCap = nCap;
96  p->pArray = p->nCap? ABC_ALLOC( int, p->nCap ) : NULL;
97  return p;
98 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static Vec_Int_t* Vec_IntAllocArray ( int *  pArray,
int  nSize 
)
inlinestatic

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 171 of file vecInt.h.

172 {
173  Vec_Int_t * p;
174  p = ABC_ALLOC( Vec_Int_t, 1 );
175  p->nSize = nSize;
176  p->nCap = nSize;
177  p->pArray = pArray;
178  return p;
179 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static Vec_Int_t* Vec_IntAllocArrayCopy ( int *  pArray,
int  nSize 
)
inlinestatic

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 192 of file vecInt.h.

193 {
194  Vec_Int_t * p;
195  p = ABC_ALLOC( Vec_Int_t, 1 );
196  p->nSize = nSize;
197  p->nCap = nSize;
198  p->pArray = ABC_ALLOC( int, nSize );
199  memcpy( p->pArray, pArray, sizeof(int) * nSize );
200  return p;
201 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
char * memcpy()
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static void Vec_IntAppend ( Vec_Int_t vVec1,
Vec_Int_t vVec2 
)
inlinestatic

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

Synopsis [Appends the contents of the second vector.]

Description []

SideEffects []

SeeAlso []

Definition at line 1849 of file vecInt.h.

1850 {
1851  int Entry, i;
1852  Vec_IntForEachEntry( vVec2, Entry, i )
1853  Vec_IntPush( vVec1, Entry );
1854 }
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: vecInt.h:690
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static int* Vec_IntArray ( Vec_Int_t p)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 328 of file vecInt.h.

329 {
330  return p->pArray;
331 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int** Vec_IntArrayP ( Vec_Int_t p)
inlinestatic

Definition at line 332 of file vecInt.h.

333 {
334  return &p->pArray;
335 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_IntCap ( Vec_Int_t p)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 368 of file vecInt.h.

369 {
370  return p->nCap;
371 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_IntCheckUniqueSmall ( Vec_Int_t p)
inlinestatic

Definition at line 1336 of file vecInt.h.

1337 {
1338  int i, k;
1339  for ( i = 0; i < p->nSize; i++ )
1340  for ( k = i+1; k < p->nSize; k++ )
1341  if ( p->pArray[i] == p->pArray[k] )
1342  return 0;
1343  return 1;
1344 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_IntClear ( Vec_Int_t p)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 674 of file vecInt.h.

675 {
676  p->nSize = 0;
677 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_IntCompareVec ( Vec_Int_t p1,
Vec_Int_t p2 
)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1829 of file vecInt.h.

1830 {
1831  if ( p1 == NULL || p2 == NULL )
1832  return (p1 != NULL) - (p2 != NULL);
1833  if ( Vec_IntSize(p1) != Vec_IntSize(p2) )
1834  return Vec_IntSize(p1) - Vec_IntSize(p2);
1835  return memcmp( Vec_IntArray(p1), Vec_IntArray(p2), sizeof(int)*Vec_IntSize(p1) );
1836 }
static int * Vec_IntArray(Vec_Int_t *p)
Definition: vecInt.h:328
static int Vec_IntSize(Vec_Int_t *p)
Definition: vecInt.h:352
int memcmp()
static Vec_Int_t* Vec_IntCondense ( Vec_Int_t p,
int  Fill 
)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1116 of file vecInt.h.

1117 {
1118  int Entry, i;
1119  Vec_Int_t * vRes = Vec_IntAlloc( Vec_IntSize(p) );
1120  Vec_IntForEachEntry( p, Entry, i )
1121  if ( Entry != Fill )
1122  Vec_IntPush( vRes, Entry );
1123  return vRes;
1124 }
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: vecInt.h:690
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Vec_IntSize(Vec_Int_t *p)
Definition: vecInt.h:352
if(last==0)
Definition: sparse_int.h:34
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecInt.h:88
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static int Vec_IntCountCommon ( Vec_Int_t p1,
Vec_Int_t p2 
)
inlinestatic

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

Synopsis [Counts the number of common entries.]

Description [Assumes that the entries are non-negative integers that are not very large, so inversion of the array can be performed.]

SideEffects []

SeeAlso []

Definition at line 1224 of file vecInt.h.

1225 {
1226  Vec_Int_t * vTemp;
1227  int Entry, i, Counter = 0;
1228  if ( Vec_IntSize(p1) < Vec_IntSize(p2) )
1229  vTemp = p1, p1 = p2, p2 = vTemp;
1230  assert( Vec_IntSize(p1) >= Vec_IntSize(p2) );
1231  vTemp = Vec_IntInvert( p2, -1 );
1232  Vec_IntFillExtra( vTemp, Vec_IntFindMax(p1) + 1, -1 );
1233  Vec_IntForEachEntry( p1, Entry, i )
1234  if ( Vec_IntEntry(vTemp, Entry) >= 0 )
1235  Counter++;
1236  Vec_IntFree( vTemp );
1237  return Counter;
1238 }
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: vecInt.h:400
static void Vec_IntFillExtra(Vec_Int_t *p, int nSize, int Fill)
Definition: vecInt.h:576
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Vec_Int_t * Vec_IntInvert(Vec_Int_t *p, int Fill)
Definition: vecInt.h:1092
static int Vec_IntSize(Vec_Int_t *p)
Definition: vecInt.h:352
static int Vec_IntFindMax(Vec_Int_t *p)
Definition: vecInt.h:996
if(last==0)
Definition: sparse_int.h:34
static int Counter
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: vecInt.h:272
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static int Vec_IntCountDuplicates ( Vec_Int_t p)
inlinestatic

Definition at line 1327 of file vecInt.h.

1328 {
1329  int RetValue;
1330  Vec_Int_t * pDup = Vec_IntDup( p );
1331  Vec_IntUniqify( pDup );
1332  RetValue = Vec_IntSize(p) - Vec_IntSize(pDup);
1333  Vec_IntFree( pDup );
1334  return RetValue;
1335 }
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Vec_IntSize(Vec_Int_t *p)
Definition: vecInt.h:352
static int Vec_IntUniqify(Vec_Int_t *p)
Definition: vecInt.h:1314
static void Vec_IntFree(Vec_Int_t *p)
Definition: vecInt.h:272
static int Vec_IntCountEntry ( Vec_Int_t p,
int  Entry 
)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1156 of file vecInt.h.

1157 {
1158  int i, Counter = 0;
1159  for ( i = 0; i < p->nSize; i++ )
1160  Counter += (p->pArray[i] == Entry);
1161  return Counter;
1162 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Counter
static int Vec_IntCountPositive ( Vec_Int_t p)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1175 of file vecInt.h.

1176 {
1177  int i, Counter = 0;
1178  for ( i = 0; i < p->nSize; i++ )
1179  Counter += (p->pArray[i] > 0);
1180  return Counter;
1181 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Counter
static int Vec_IntCountUnique ( Vec_Int_t p)
inlinestatic

Definition at line 1345 of file vecInt.h.

1346 {
1347  int i, Count = 0, Max = Vec_IntFindMax(p);
1348  unsigned char * pPres = ABC_CALLOC( unsigned char, Max+1 );
1349  for ( i = 0; i < p->nSize; i++ )
1350  if ( pPres[p->pArray[i]] == 0 )
1351  pPres[p->pArray[i]] = 1, Count++;
1352  ABC_FREE( pPres );
1353  return Count;
1354 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_IntFindMax(Vec_Int_t *p)
Definition: vecInt.h:996
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
static int Vec_IntCountZero ( Vec_Int_t p)
inlinestatic

Definition at line 1182 of file vecInt.h.

1183 {
1184  int i, Counter = 0;
1185  for ( i = 0; i < p->nSize; i++ )
1186  Counter += (p->pArray[i] == 0);
1187  return Counter;
1188 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Counter
static void Vec_IntDowndateEntry ( Vec_Int_t p,
int  i,
int  Value 
)
inlinestatic

Definition at line 473 of file vecInt.h.

474 {
475  if ( Vec_IntEntry( p, i ) > Value )
476  Vec_IntWriteEntry( p, i, Value );
477 }
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: vecInt.h:400
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: vecInt.h:434
static void Vec_IntDrop ( Vec_Int_t p,
int  i 
)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 955 of file vecInt.h.

956 {
957  int k;
958  assert( i >= 0 && i < Vec_IntSize(p) );
959  p->nSize--;
960  for ( k = i; k < p->nSize; k++ )
961  p->pArray[k] = p->pArray[k+1];
962 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_IntSize(Vec_Int_t *p)
Definition: vecInt.h:352
#define assert(ex)
Definition: util_old.h:213
static Vec_Int_t* Vec_IntDup ( Vec_Int_t pVec)
inlinestatic

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

Synopsis [Duplicates the integer array.]

Description []

SideEffects []

SeeAlso []

Definition at line 214 of file vecInt.h.

215 {
216  Vec_Int_t * p;
217  p = ABC_ALLOC( Vec_Int_t, 1 );
218  p->nSize = pVec->nSize;
219  p->nCap = pVec->nSize;
220  p->pArray = p->nCap? ABC_ALLOC( int, p->nCap ) : NULL;
221  memcpy( p->pArray, pVec->pArray, sizeof(int) * pVec->nSize );
222  return p;
223 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
char * memcpy()
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static Vec_Int_t* Vec_IntDupArray ( Vec_Int_t pVec)
inlinestatic

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

Synopsis [Transfers the array into another vector.]

Description []

SideEffects []

SeeAlso []

Definition at line 236 of file vecInt.h.

237 {
238  Vec_Int_t * p;
239  p = ABC_ALLOC( Vec_Int_t, 1 );
240  p->nSize = pVec->nSize;
241  p->nCap = pVec->nCap;
242  p->pArray = pVec->pArray;
243  pVec->nSize = 0;
244  pVec->nCap = 0;
245  pVec->pArray = NULL;
246  return p;
247 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static int Vec_IntEntry ( Vec_Int_t p,
int  i 
)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 400 of file vecInt.h.

401 {
402  assert( i >= 0 && i < p->nSize );
403  return p->pArray[i];
404 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
static int Vec_IntEntryLast ( Vec_Int_t p)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 490 of file vecInt.h.

491 {
492  assert( p->nSize > 0 );
493  return p->pArray[p->nSize-1];
494 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
static int* Vec_IntEntryP ( Vec_Int_t p,
int  i 
)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 417 of file vecInt.h.

418 {
419  assert( i >= 0 && i < p->nSize );
420  return p->pArray + i;
421 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
static int Vec_IntEqual ( Vec_Int_t p1,
Vec_Int_t p2 
)
inlinestatic

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

Synopsis [Checks if two vectors are equal.]

Description []

SideEffects []

SeeAlso []

Definition at line 1201 of file vecInt.h.

1202 {
1203  int i;
1204  if ( p1->nSize != p2->nSize )
1205  return 0;
1206  for ( i = 0; i < p1->nSize; i++ )
1207  if ( p1->pArray[i] != p2->pArray[i] )
1208  return 0;
1209  return 1;
1210 }
static void Vec_IntErase ( Vec_Int_t p)
inlinestatic

Definition at line 266 of file vecInt.h.

267 {
268  ABC_FREE( p->pArray );
269  p->nSize = 0;
270  p->nCap = 0;
271 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_FREE(obj)
Definition: abc_global.h:232
static unsigned* Vec_IntFetch ( Vec_Int_t p,
int  nWords 
)
inlinestatic

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 853 of file vecInt.h.

854 {
855  if ( nWords == 0 )
856  return NULL;
857  assert( nWords > 0 );
858  p->nSize += nWords;
859  if ( p->nSize > p->nCap )
860  {
861 // Vec_IntGrow( p, 2 * p->nSize );
862  return NULL;
863  }
864  return ((unsigned *)p->pArray) + p->nSize - nWords;
865 }
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_IntFill ( Vec_Int_t p,
int  nSize,
int  Fill 
)
inlinestatic

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 548 of file vecInt.h.

549 {
550  int i;
551  Vec_IntGrow( p, nSize );
552  for ( i = 0; i < nSize; i++ )
553  p->pArray[i] = Fill;
554  p->nSize = nSize;
555 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_IntGrow(Vec_Int_t *p, int nCapMin)
Definition: vecInt.h:507
static void Vec_IntFillExtra ( Vec_Int_t p,
int  nSize,
int  Fill 
)
inlinestatic

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 576 of file vecInt.h.

577 {
578  int i;
579  if ( nSize <= p->nSize )
580  return;
581  if ( nSize > 2 * p->nCap )
582  Vec_IntGrow( p, nSize );
583  else if ( nSize > p->nCap )
584  Vec_IntGrow( p, 2 * p->nCap );
585  for ( i = p->nSize; i < nSize; i++ )
586  p->pArray[i] = Fill;
587  p->nSize = nSize;
588 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_IntGrow(Vec_Int_t *p, int nCapMin)
Definition: vecInt.h:507
static void Vec_IntFillTwo ( Vec_Int_t p,
int  nSize,
int  FillEven,
int  FillOdd 
)
inlinestatic

Definition at line 556 of file vecInt.h.

557 {
558  int i;
559  Vec_IntGrow( p, nSize );
560  for ( i = 0; i < nSize; i++ )
561  p->pArray[i] = (i & 1) ? FillOdd : FillEven;
562  p->nSize = nSize;
563 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_IntGrow(Vec_Int_t *p, int nCapMin)
Definition: vecInt.h:507
static int Vec_IntFind ( Vec_Int_t p,
int  Entry 
)
inlinestatic

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

Synopsis [Find entry.]

Description []

SideEffects []

SeeAlso []

Definition at line 895 of file vecInt.h.

896 {
897  int i;
898  for ( i = 0; i < p->nSize; i++ )
899  if ( p->pArray[i] == Entry )
900  return i;
901  return -1;
902 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_IntFindMax ( Vec_Int_t p)
inlinestatic

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

Synopsis [Find entry.]

Description []

SideEffects []

SeeAlso []

Definition at line 996 of file vecInt.h.

997 {
998  int i, Best;
999  if ( p->nSize == 0 )
1000  return 0;
1001  Best = p->pArray[0];
1002  for ( i = 1; i < p->nSize; i++ )
1003  if ( Best < p->pArray[i] )
1004  Best = p->pArray[i];
1005  return Best;
1006 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_IntFindMin ( Vec_Int_t p)
inlinestatic

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

Synopsis [Find entry.]

Description []

SideEffects []

SeeAlso []

Definition at line 1019 of file vecInt.h.

1020 {
1021  int i, Best;
1022  if ( p->nSize == 0 )
1023  return 0;
1024  Best = p->pArray[0];
1025  for ( i = 1; i < p->nSize; i++ )
1026  if ( Best > p->pArray[i] )
1027  Best = p->pArray[i];
1028  return Best;
1029 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_IntFree ( Vec_Int_t p)
inlinestatic

Definition at line 272 of file vecInt.h.

273 {
274  ABC_FREE( p->pArray );
275  ABC_FREE( p );
276 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_FREE(obj)
Definition: abc_global.h:232
static void Vec_IntFreeP ( Vec_Int_t **  p)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 289 of file vecInt.h.

290 {
291  if ( *p == NULL )
292  return;
293  ABC_FREE( (*p)->pArray );
294  ABC_FREE( (*p) );
295 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_FREE(obj)
Definition: abc_global.h:232
static int Vec_IntGetEntry ( Vec_Int_t p,
int  i 
)
inlinestatic

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 601 of file vecInt.h.

602 {
603  Vec_IntFillExtra( p, i + 1, 0 );
604  return Vec_IntEntry( p, i );
605 }
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: vecInt.h:400
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_IntFillExtra(Vec_Int_t *p, int nSize, int Fill)
Definition: vecInt.h:576
static int* Vec_IntGetEntryP ( Vec_Int_t p,
int  i 
)
inlinestatic

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 618 of file vecInt.h.

619 {
620  Vec_IntFillExtra( p, i + 1, 0 );
621  return Vec_IntEntryP( p, i );
622 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_IntFillExtra(Vec_Int_t *p, int nSize, int Fill)
Definition: vecInt.h:576
static int * Vec_IntEntryP(Vec_Int_t *p, int i)
Definition: vecInt.h:417
static void Vec_IntGrow ( Vec_Int_t p,
int  nCapMin 
)
inlinestatic

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

Synopsis [Resizes the vector to the given capacity.]

Description []

SideEffects []

SeeAlso []

Definition at line 507 of file vecInt.h.

508 {
509  if ( p->nCap >= nCapMin )
510  return;
511  p->pArray = ABC_REALLOC( int, p->pArray, nCapMin );
512  assert( p->pArray );
513  p->nCap = nCapMin;
514 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_REALLOC(type, obj, num)
Definition: abc_global.h:233
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntGrowResize ( Vec_Int_t p,
int  nCapMin 
)
inlinestatic

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

Synopsis [Resizes the vector to the given capacity.]

Description []

SideEffects []

SeeAlso []

Definition at line 527 of file vecInt.h.

528 {
529  p->nSize = nCapMin;
530  if ( p->nCap >= nCapMin )
531  return;
532  p->pArray = ABC_REALLOC( int, p->pArray, nCapMin );
533  assert( p->pArray );
534  p->nCap = nCapMin;
535 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_REALLOC(type, obj, num)
Definition: abc_global.h:233
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntInsert ( Vec_Int_t p,
int  iHere,
int  Entry 
)
inlinestatic

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 975 of file vecInt.h.

976 {
977  int i;
978  assert( iHere >= 0 && iHere < p->nSize );
979  Vec_IntPush( p, 0 );
980  for ( i = p->nSize - 1; i > iHere; i-- )
981  p->pArray[i] = p->pArray[i-1];
982  p->pArray[i] = Entry;
983 }
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: vecInt.h:690
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
static Vec_Int_t* Vec_IntInvert ( Vec_Int_t p,
int  Fill 
)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1092 of file vecInt.h.

1093 {
1094  int Entry, i;
1095  Vec_Int_t * vRes = Vec_IntAlloc( 0 );
1096  if ( Vec_IntSize(p) == 0 )
1097  return vRes;
1098  Vec_IntFill( vRes, Vec_IntFindMax(p) + 1, Fill );
1099  Vec_IntForEachEntry( p, Entry, i )
1100  if ( Entry != Fill )
1101  Vec_IntWriteEntry( vRes, Entry, i );
1102  return vRes;
1103 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: vecInt.h:548
static int Vec_IntSize(Vec_Int_t *p)
Definition: vecInt.h:352
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: vecInt.h:434
static int Vec_IntFindMax(Vec_Int_t *p)
Definition: vecInt.h:996
if(last==0)
Definition: sparse_int.h:34
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecInt.h:88
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static int* Vec_IntLimit ( Vec_Int_t p)
inlinestatic

Definition at line 336 of file vecInt.h.

337 {
338  return p->pArray + p->nSize;
339 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static double Vec_IntMemory ( Vec_Int_t p)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 384 of file vecInt.h.

385 {
386  return !p ? 0.0 : 1.0 * sizeof(int) * p->nCap + sizeof(Vec_Int_t) ;
387 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Vec_IntPop ( Vec_Int_t p)
inlinestatic

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 878 of file vecInt.h.

879 {
880  assert( p->nSize > 0 );
881  return p->pArray[--p->nSize];
882 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntPrint ( Vec_Int_t vVec)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1803 of file vecInt.h.

1804 {
1805  int i, Entry;
1806  printf( "Vector has %d entries: {", Vec_IntSize(vVec) );
1807  Vec_IntForEachEntry( vVec, Entry, i )
1808  printf( " %d", Entry );
1809  printf( " }\n" );
1810 }
static int Vec_IntSize(Vec_Int_t *p)
Definition: vecInt.h:352
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static void Vec_IntPrintBinary ( Vec_Int_t vVec)
inlinestatic

Definition at line 1811 of file vecInt.h.

1812 {
1813  int i, Entry;
1814  Vec_IntForEachEntry( vVec, Entry, i )
1815  printf( "%d", (int)(Entry != 0) );
1816 }
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static void Vec_IntPush ( Vec_Int_t p,
int  Entry 
)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 690 of file vecInt.h.

691 {
692  if ( p->nSize == p->nCap )
693  {
694  if ( p->nCap < 16 )
695  Vec_IntGrow( p, 16 );
696  else
697  Vec_IntGrow( p, 2 * p->nCap );
698  }
699  p->pArray[p->nSize++] = Entry;
700 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_IntGrow(Vec_Int_t *p, int nCapMin)
Definition: vecInt.h:507
static void Vec_IntPushArray ( Vec_Int_t p,
int *  pEntries,
int  nEntries 
)
inlinestatic

Definition at line 706 of file vecInt.h.

707 {
708  int i;
709  for ( i = 0; i < nEntries; i++ )
710  Vec_IntPush( p, pEntries[i] );
711 }
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: vecInt.h:690
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_IntPushFirst ( Vec_Int_t p,
int  Entry 
)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 724 of file vecInt.h.

725 {
726  int i;
727  if ( p->nSize == p->nCap )
728  {
729  if ( p->nCap < 16 )
730  Vec_IntGrow( p, 16 );
731  else
732  Vec_IntGrow( p, 2 * p->nCap );
733  }
734  p->nSize++;
735  for ( i = p->nSize - 1; i >= 1; i-- )
736  p->pArray[i] = p->pArray[i-1];
737  p->pArray[0] = Entry;
738 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_IntGrow(Vec_Int_t *p, int nCapMin)
Definition: vecInt.h:507
static void Vec_IntPushOrder ( Vec_Int_t p,
int  Entry 
)
inlinestatic

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 751 of file vecInt.h.

752 {
753  int i;
754  if ( p->nSize == p->nCap )
755  {
756  if ( p->nCap < 16 )
757  Vec_IntGrow( p, 16 );
758  else
759  Vec_IntGrow( p, 2 * p->nCap );
760  }
761  p->nSize++;
762  for ( i = p->nSize-2; i >= 0; i-- )
763  if ( p->pArray[i] > Entry )
764  p->pArray[i+1] = p->pArray[i];
765  else
766  break;
767  p->pArray[i+1] = Entry;
768 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_IntGrow(Vec_Int_t *p, int nCapMin)
Definition: vecInt.h:507
static void Vec_IntPushOrderReverse ( Vec_Int_t p,
int  Entry 
)
inlinestatic

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 781 of file vecInt.h.

782 {
783  int i;
784  if ( p->nSize == p->nCap )
785  {
786  if ( p->nCap < 16 )
787  Vec_IntGrow( p, 16 );
788  else
789  Vec_IntGrow( p, 2 * p->nCap );
790  }
791  p->nSize++;
792  for ( i = p->nSize-2; i >= 0; i-- )
793  if ( p->pArray[i] < Entry )
794  p->pArray[i+1] = p->pArray[i];
795  else
796  break;
797  p->pArray[i+1] = Entry;
798 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_IntGrow(Vec_Int_t *p, int nCapMin)
Definition: vecInt.h:507
static void Vec_IntPushTwo ( Vec_Int_t p,
int  Entry1,
int  Entry2 
)
inlinestatic

Definition at line 701 of file vecInt.h.

702 {
703  Vec_IntPush( p, Entry1 );
704  Vec_IntPush( p, Entry2 );
705 }
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: vecInt.h:690
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_IntPushUnique ( Vec_Int_t p,
int  Entry 
)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 832 of file vecInt.h.

833 {
834  int i;
835  for ( i = 0; i < p->nSize; i++ )
836  if ( p->pArray[i] == Entry )
837  return 1;
838  Vec_IntPush( p, Entry );
839  return 0;
840 }
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: vecInt.h:690
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_IntPushUniqueOrder ( Vec_Int_t p,
int  Entry 
)
inlinestatic

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 811 of file vecInt.h.

812 {
813  int i;
814  for ( i = 0; i < p->nSize; i++ )
815  if ( p->pArray[i] == Entry )
816  return 1;
817  Vec_IntPushOrder( p, Entry );
818  return 0;
819 }
static void Vec_IntPushOrder(Vec_Int_t *p, int Entry)
Definition: vecInt.h:751
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int* Vec_IntReleaseArray ( Vec_Int_t p)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 308 of file vecInt.h.

309 {
310  int * pArray = p->pArray;
311  p->nCap = 0;
312  p->nSize = 0;
313  p->pArray = NULL;
314  return pArray;
315 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_IntRemove ( Vec_Int_t p,
int  Entry 
)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 915 of file vecInt.h.

916 {
917  int i;
918  for ( i = 0; i < p->nSize; i++ )
919  if ( p->pArray[i] == Entry )
920  break;
921  if ( i == p->nSize )
922  return 0;
923  assert( i < p->nSize );
924  for ( i++; i < p->nSize; i++ )
925  p->pArray[i-1] = p->pArray[i];
926  p->nSize--;
927  return 1;
928 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
static int Vec_IntRemove1 ( Vec_Int_t p,
int  Entry 
)
inlinestatic

Definition at line 929 of file vecInt.h.

930 {
931  int i;
932  for ( i = 1; i < p->nSize; i++ )
933  if ( p->pArray[i] == Entry )
934  break;
935  if ( i >= p->nSize )
936  return 0;
937  assert( i < p->nSize );
938  for ( i++; i < p->nSize; i++ )
939  p->pArray[i-1] = p->pArray[i];
940  p->nSize--;
941  return 1;
942 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntRemoveEven ( Vec_Int_t p)
inlinestatic

Definition at line 1072 of file vecInt.h.

1073 {
1074  int i;
1075  assert( (p->nSize & 1) == 0 );
1076  p->nSize >>= 1;
1077  for ( i = 0; i < p->nSize; i++ )
1078  p->pArray[i] = p->pArray[2*i+1];
1079 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntRemoveOdd ( Vec_Int_t p)
inlinestatic

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

Synopsis [Removes odd entries.]

Description []

SideEffects []

SeeAlso []

Definition at line 1064 of file vecInt.h.

1065 {
1066  int i;
1067  assert( (p->nSize & 1) == 0 );
1068  p->nSize >>= 1;
1069  for ( i = 0; i < p->nSize; i++ )
1070  p->pArray[i] = p->pArray[2*i];
1071 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntReverseOrder ( Vec_Int_t p)
inlinestatic

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

Synopsis [Reverses the order of entries.]

Description []

SideEffects []

SeeAlso []

Definition at line 1042 of file vecInt.h.

1043 {
1044  int i, Temp;
1045  for ( i = 0; i < p->nSize/2; i++ )
1046  {
1047  Temp = p->pArray[i];
1048  p->pArray[i] = p->pArray[p->nSize-1-i];
1049  p->pArray[p->nSize-1-i] = Temp;
1050  }
1051 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_IntSelectSort ( int *  pArray,
int  nSize 
)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1740 of file vecInt.h.

1741 {
1742  int temp, i, j, best_i;
1743  for ( i = 0; i < nSize-1; i++ )
1744  {
1745  best_i = i;
1746  for ( j = i+1; j < nSize; j++ )
1747  if ( pArray[j] < pArray[best_i] )
1748  best_i = j;
1749  temp = pArray[i];
1750  pArray[i] = pArray[best_i];
1751  pArray[best_i] = temp;
1752  }
1753 }
static void Vec_IntSelectSortCost ( int *  pArray,
int  nSize,
Vec_Int_t vCosts 
)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1766 of file vecInt.h.

1767 {
1768  int i, j, best_i;
1769  for ( i = 0; i < nSize-1; i++ )
1770  {
1771  best_i = i;
1772  for ( j = i+1; j < nSize; j++ )
1773  if ( Vec_IntEntry(vCosts, pArray[j]) < Vec_IntEntry(vCosts, pArray[best_i]) )
1774  best_i = j;
1775  ABC_SWAP( int, pArray[i], pArray[best_i] );
1776  }
1777 }
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: vecInt.h:400
#define ABC_SWAP(Type, a, b)
Definition: abc_global.h:218
static void Vec_IntSelectSortCost2 ( int *  pArray,
int  nSize,
int *  pCosts 
)
inlinestatic

Definition at line 1778 of file vecInt.h.

1779 {
1780  int i, j, best_i;
1781  for ( i = 0; i < nSize-1; i++ )
1782  {
1783  best_i = i;
1784  for ( j = i+1; j < nSize; j++ )
1785  if ( pCosts[j] < pCosts[best_i] )
1786  best_i = j;
1787  ABC_SWAP( int, pArray[i], pArray[best_i] );
1788  ABC_SWAP( int, pCosts[i], pCosts[best_i] );
1789  }
1790 }
#define ABC_SWAP(Type, a, b)
Definition: abc_global.h:218
static void Vec_IntSetEntry ( Vec_Int_t p,
int  i,
int  Entry 
)
inlinestatic

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 635 of file vecInt.h.

636 {
637  Vec_IntFillExtra( p, i + 1, 0 );
638  Vec_IntWriteEntry( p, i, Entry );
639 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_IntFillExtra(Vec_Int_t *p, int nSize, int Fill)
Definition: vecInt.h:576
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: vecInt.h:434
static void Vec_IntSetEntryFull ( Vec_Int_t p,
int  i,
int  Entry 
)
inlinestatic

Definition at line 640 of file vecInt.h.

641 {
642  Vec_IntFillExtra( p, i + 1, -1 );
643  Vec_IntWriteEntry( p, i, Entry );
644 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_IntFillExtra(Vec_Int_t *p, int nSize, int Fill)
Definition: vecInt.h:576
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: vecInt.h:434
static void Vec_IntShrink ( Vec_Int_t p,
int  nSizeNew 
)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 657 of file vecInt.h.

658 {
659  assert( p->nSize >= nSizeNew );
660  p->nSize = nSizeNew;
661 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
static int Vec_IntSize ( Vec_Int_t p)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 352 of file vecInt.h.

353 {
354  return p->nSize;
355 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_IntSort ( Vec_Int_t p,
int  fReverse 
)
inlinestatic

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

Synopsis [Sorting the entries by their integer value.]

Description []

SideEffects []

SeeAlso []

Definition at line 1293 of file vecInt.h.

1294 {
1295  if ( fReverse )
1296  qsort( (void *)p->pArray, p->nSize, sizeof(int),
1297  (int (*)(const void *, const void *)) Vec_IntSortCompare2 );
1298  else
1299  qsort( (void *)p->pArray, p->nSize, sizeof(int),
1300  (int (*)(const void *, const void *)) Vec_IntSortCompare1 );
1301 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_IntSortCompare1(int *pp1, int *pp2)
Definition: vecInt.h:1251
static int Vec_IntSortCompare2(int *pp1, int *pp2)
Definition: vecInt.h:1272
static int Vec_IntSortCompare1 ( int *  pp1,
int *  pp2 
)
static

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

Synopsis [Comparison procedure for two integers.]

Description []

SideEffects []

SeeAlso []

Definition at line 1251 of file vecInt.h.

1252 {
1253  // for some reason commenting out lines (as shown) led to crashing of the release version
1254  if ( *pp1 < *pp2 )
1255  return -1;
1256  if ( *pp1 > *pp2 ) //
1257  return 1;
1258  return 0; //
1259 }
static int Vec_IntSortCompare2 ( int *  pp1,
int *  pp2 
)
static

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

Synopsis [Comparison procedure for two integers.]

Description []

SideEffects []

SeeAlso []

Definition at line 1272 of file vecInt.h.

1273 {
1274  // for some reason commenting out lines (as shown) led to crashing of the release version
1275  if ( *pp1 > *pp2 )
1276  return -1;
1277  if ( *pp1 < *pp2 ) //
1278  return 1;
1279  return 0; //
1280 }
static int Vec_IntSortCompareUnsigned ( unsigned *  pp1,
unsigned *  pp2 
)
inlinestatic

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

Synopsis [Comparison procedure for two integers.]

Description []

SideEffects []

SeeAlso []

Definition at line 1491 of file vecInt.h.

1492 {
1493  if ( *pp1 < *pp2 )
1494  return -1;
1495  if ( *pp1 > *pp2 )
1496  return 1;
1497  return 0;
1498 }
static void Vec_IntSortUnsigned ( Vec_Int_t p)
inlinestatic

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

Synopsis [Sorting the entries by their integer value.]

Description []

SideEffects []

SeeAlso []

Definition at line 1511 of file vecInt.h.

1512 {
1513  qsort( (void *)p->pArray, p->nSize, sizeof(int),
1514  (int (*)(const void *, const void *)) Vec_IntSortCompareUnsigned );
1515 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_IntSortCompareUnsigned(unsigned *pp1, unsigned *pp2)
Definition: vecInt.h:1491
static Vec_Int_t* Vec_IntStart ( int  nSize)
inlinestatic

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 111 of file vecInt.h.

112 {
113  Vec_Int_t * p;
114  p = Vec_IntAlloc( nSize );
115  p->nSize = nSize;
116  memset( p->pArray, 0, sizeof(int) * nSize );
117  return p;
118 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecInt.h:88
static Vec_Int_t* Vec_IntStartFull ( int  nSize)
inlinestatic

Definition at line 119 of file vecInt.h.

120 {
121  Vec_Int_t * p;
122  p = Vec_IntAlloc( nSize );
123  p->nSize = nSize;
124  memset( p->pArray, 0xff, sizeof(int) * nSize );
125  return p;
126 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecInt.h:88
static Vec_Int_t* Vec_IntStartNatural ( int  nSize)
inlinestatic

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 149 of file vecInt.h.

150 {
151  Vec_Int_t * p;
152  int i;
153  p = Vec_IntAlloc( nSize );
154  p->nSize = nSize;
155  for ( i = 0; i < nSize; i++ )
156  p->pArray[i] = i;
157  return p;
158 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecInt.h:88
static Vec_Int_t* Vec_IntStartRange ( int  First,
int  Range 
)
inlinestatic

Definition at line 127 of file vecInt.h.

128 {
129  Vec_Int_t * p;
130  int i;
131  p = Vec_IntAlloc( Range );
132  p->nSize = Range;
133  for ( i = 0; i < Range; i++ )
134  p->pArray[i] = First + i;
135  return p;
136 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecInt.h:88
static int Vec_IntSum ( Vec_Int_t p)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1137 of file vecInt.h.

1138 {
1139  int i, Counter = 0;
1140  for ( i = 0; i < p->nSize; i++ )
1141  Counter += p->pArray[i];
1142  return Counter;
1143 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Counter
static int Vec_IntTwoCountCommon ( Vec_Int_t vArr1,
Vec_Int_t vArr2 
)
inlinestatic

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

Synopsis [Returns the number of common entries.]

Description [Assumes that the vectors are sorted in the increasing order.]

SideEffects []

SeeAlso []

Definition at line 1528 of file vecInt.h.

1529 {
1530  int * pBeg1 = vArr1->pArray;
1531  int * pBeg2 = vArr2->pArray;
1532  int * pEnd1 = vArr1->pArray + vArr1->nSize;
1533  int * pEnd2 = vArr2->pArray + vArr2->nSize;
1534  int Counter = 0;
1535  while ( pBeg1 < pEnd1 && pBeg2 < pEnd2 )
1536  {
1537  if ( *pBeg1 == *pBeg2 )
1538  pBeg1++, pBeg2++, Counter++;
1539  else if ( *pBeg1 < *pBeg2 )
1540  pBeg1++;
1541  else
1542  pBeg2++;
1543  }
1544  return Counter;
1545 }
static int Counter
static int Vec_IntTwoFindCommon ( Vec_Int_t vArr1,
Vec_Int_t vArr2,
Vec_Int_t vArr 
)
inlinestatic

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

Synopsis [Collects common entries.]

Description [Assumes that the vectors are sorted in the increasing order.]

SideEffects []

SeeAlso []

Definition at line 1558 of file vecInt.h.

1559 {
1560  int * pBeg1 = vArr1->pArray;
1561  int * pBeg2 = vArr2->pArray;
1562  int * pEnd1 = vArr1->pArray + vArr1->nSize;
1563  int * pEnd2 = vArr2->pArray + vArr2->nSize;
1564  Vec_IntClear( vArr );
1565  while ( pBeg1 < pEnd1 && pBeg2 < pEnd2 )
1566  {
1567  if ( *pBeg1 == *pBeg2 )
1568  Vec_IntPush( vArr, *pBeg1 ), pBeg1++, pBeg2++;
1569  else if ( *pBeg1 < *pBeg2 )
1570  pBeg1++;
1571  else
1572  pBeg2++;
1573  }
1574  return Vec_IntSize(vArr);
1575 }
static void Vec_IntClear(Vec_Int_t *p)
Definition: vecInt.h:674
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: vecInt.h:690
static int Vec_IntSize(Vec_Int_t *p)
Definition: vecInt.h:352
static Vec_Int_t* Vec_IntTwoMerge ( Vec_Int_t vArr1,
Vec_Int_t vArr2 
)
inlinestatic

Definition at line 1684 of file vecInt.h.

1685 {
1686  Vec_Int_t * vArr = Vec_IntAlloc( vArr1->nSize + vArr2->nSize );
1687  Vec_IntTwoMerge2Int( vArr1, vArr2, vArr );
1688  return vArr;
1689 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecInt.h:88
static void Vec_IntTwoMerge2Int(Vec_Int_t *vArr1, Vec_Int_t *vArr2, Vec_Int_t *vArr)
Definition: vecInt.h:1659
static void Vec_IntTwoMerge2 ( Vec_Int_t vArr1,
Vec_Int_t vArr2,
Vec_Int_t vArr 
)
inlinestatic

Definition at line 1690 of file vecInt.h.

1691 {
1692  Vec_IntGrow( vArr, Vec_IntSize(vArr1) + Vec_IntSize(vArr2) );
1693  Vec_IntTwoMerge2Int( vArr1, vArr2, vArr );
1694 }
static int Vec_IntSize(Vec_Int_t *p)
Definition: vecInt.h:352
static void Vec_IntGrow(Vec_Int_t *p, int nCapMin)
Definition: vecInt.h:507
static void Vec_IntTwoMerge2Int(Vec_Int_t *vArr1, Vec_Int_t *vArr2, Vec_Int_t *vArr)
Definition: vecInt.h:1659
static void Vec_IntTwoMerge2Int ( Vec_Int_t vArr1,
Vec_Int_t vArr2,
Vec_Int_t vArr 
)
inlinestatic

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

Synopsis [Returns the result of merging the two vectors.]

Description [Assumes that the vectors are sorted in the increasing order.]

SideEffects []

SeeAlso []

Definition at line 1659 of file vecInt.h.

1660 {
1661  int * pBeg = vArr->pArray;
1662  int * pBeg1 = vArr1->pArray;
1663  int * pBeg2 = vArr2->pArray;
1664  int * pEnd1 = vArr1->pArray + vArr1->nSize;
1665  int * pEnd2 = vArr2->pArray + vArr2->nSize;
1666  while ( pBeg1 < pEnd1 && pBeg2 < pEnd2 )
1667  {
1668  if ( *pBeg1 == *pBeg2 )
1669  *pBeg++ = *pBeg1++, pBeg2++;
1670  else if ( *pBeg1 < *pBeg2 )
1671  *pBeg++ = *pBeg1++;
1672  else
1673  *pBeg++ = *pBeg2++;
1674  }
1675  while ( pBeg1 < pEnd1 )
1676  *pBeg++ = *pBeg1++;
1677  while ( pBeg2 < pEnd2 )
1678  *pBeg++ = *pBeg2++;
1679  vArr->nSize = pBeg - vArr->pArray;
1680  assert( vArr->nSize <= vArr->nCap );
1681  assert( vArr->nSize >= vArr1->nSize );
1682  assert( vArr->nSize >= vArr2->nSize );
1683 }
#define assert(ex)
Definition: util_old.h:213
static int Vec_IntTwoRemove ( Vec_Int_t vArr1,
Vec_Int_t vArr2 
)
inlinestatic

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

Synopsis [Removes entries of the second one from the first one.]

Description [Assumes that the vectors are sorted in the increasing order.]

SideEffects []

SeeAlso []

Definition at line 1626 of file vecInt.h.

1627 {
1628  int * pBeg1 = vArr1->pArray;
1629  int * pBeg2 = vArr2->pArray;
1630  int * pEnd1 = vArr1->pArray + vArr1->nSize;
1631  int * pEnd2 = vArr2->pArray + vArr2->nSize;
1632  int * pBeg1New = vArr1->pArray;
1633  while ( pBeg1 < pEnd1 && pBeg2 < pEnd2 )
1634  {
1635  if ( *pBeg1 == *pBeg2 )
1636  pBeg1++, pBeg2++;
1637  else if ( *pBeg1 < *pBeg2 )
1638  *pBeg1New++ = *pBeg1++;
1639  else
1640  pBeg2++;
1641  }
1642  while ( pBeg1 < pEnd1 )
1643  *pBeg1New++ = *pBeg1++;
1644  Vec_IntShrink( vArr1, pBeg1New - vArr1->pArray );
1645  return Vec_IntSize(vArr1);
1646 }
static void Vec_IntShrink(Vec_Int_t *p, int nSizeNew)
Definition: vecInt.h:657
static int Vec_IntSize(Vec_Int_t *p)
Definition: vecInt.h:352
static int Vec_IntTwoRemoveCommon ( Vec_Int_t vArr1,
Vec_Int_t vArr2,
Vec_Int_t vArr 
)
inlinestatic

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

Synopsis [Collects and removes common entries]

Description [Assumes that the vectors are sorted in the increasing order.]

SideEffects []

SeeAlso []

Definition at line 1588 of file vecInt.h.

1589 {
1590  int * pBeg1 = vArr1->pArray;
1591  int * pBeg2 = vArr2->pArray;
1592  int * pEnd1 = vArr1->pArray + vArr1->nSize;
1593  int * pEnd2 = vArr2->pArray + vArr2->nSize;
1594  int * pBeg1New = vArr1->pArray;
1595  int * pBeg2New = vArr2->pArray;
1596  Vec_IntClear( vArr );
1597  while ( pBeg1 < pEnd1 && pBeg2 < pEnd2 )
1598  {
1599  if ( *pBeg1 == *pBeg2 )
1600  Vec_IntPush( vArr, *pBeg1 ), pBeg1++, pBeg2++;
1601  else if ( *pBeg1 < *pBeg2 )
1602  *pBeg1New++ = *pBeg1++;
1603  else
1604  *pBeg2New++ = *pBeg2++;
1605  }
1606  while ( pBeg1 < pEnd1 )
1607  *pBeg1New++ = *pBeg1++;
1608  while ( pBeg2 < pEnd2 )
1609  *pBeg2New++ = *pBeg2++;
1610  Vec_IntShrink( vArr1, pBeg1New - vArr1->pArray );
1611  Vec_IntShrink( vArr2, pBeg2New - vArr2->pArray );
1612  return Vec_IntSize(vArr);
1613 }
static void Vec_IntClear(Vec_Int_t *p)
Definition: vecInt.h:674
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: vecInt.h:690
static void Vec_IntShrink(Vec_Int_t *p, int nSizeNew)
Definition: vecInt.h:657
static int Vec_IntSize(Vec_Int_t *p)
Definition: vecInt.h:352
static void Vec_IntTwoSplit ( Vec_Int_t vArr1,
Vec_Int_t vArr2,
Vec_Int_t vArr,
Vec_Int_t vArr1n,
Vec_Int_t vArr2n 
)
inlinestatic

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

Synopsis [Returns the result of splitting of the two vectors.]

Description [Assumes that the vectors are sorted in the increasing order.]

SideEffects []

SeeAlso []

Definition at line 1707 of file vecInt.h.

1708 {
1709  int * pBeg1 = vArr1->pArray;
1710  int * pBeg2 = vArr2->pArray;
1711  int * pEnd1 = vArr1->pArray + vArr1->nSize;
1712  int * pEnd2 = vArr2->pArray + vArr2->nSize;
1713  while ( pBeg1 < pEnd1 && pBeg2 < pEnd2 )
1714  {
1715  if ( *pBeg1 == *pBeg2 )
1716  Vec_IntPush( vArr, *pBeg1++ ), pBeg2++;
1717  else if ( *pBeg1 < *pBeg2 )
1718  Vec_IntPush( vArr1n, *pBeg1++ );
1719  else
1720  Vec_IntPush( vArr2n, *pBeg2++ );
1721  }
1722  while ( pBeg1 < pEnd1 )
1723  Vec_IntPush( vArr1n, *pBeg1++ );
1724  while ( pBeg2 < pEnd2 )
1725  Vec_IntPush( vArr2n, *pBeg2++ );
1726 }
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: vecInt.h:690
static int Vec_IntUniqify ( Vec_Int_t p)
inlinestatic

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

Synopsis [Leaves only unique entries.]

Description [Returns the number of duplicated entried found.]

SideEffects []

SeeAlso []

Definition at line 1314 of file vecInt.h.

1315 {
1316  int i, k, RetValue;
1317  if ( p->nSize < 2 )
1318  return 0;
1319  Vec_IntSort( p, 0 );
1320  for ( i = k = 1; i < p->nSize; i++ )
1321  if ( p->pArray[i] != p->pArray[i-1] )
1322  p->pArray[k++] = p->pArray[i];
1323  RetValue = p->nSize - k;
1324  p->nSize = k;
1325  return RetValue;
1326 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_IntSort(Vec_Int_t *p, int fReverse)
Definition: vecInt.h:1293
static Vec_Int_t* Vec_IntUniqifyHash ( Vec_Int_t vData,
int  nIntSize 
)
inlinestatic

Definition at line 1464 of file vecInt.h.

1465 {
1466  Vec_Int_t * vMap, * vUnique;
1467  int i, Ent, nUnique = Vec_IntUniqueCount( vData, nIntSize, &vMap );
1468  vUnique = Vec_IntAlloc( nUnique * nIntSize );
1469  Vec_IntForEachEntry( vMap, Ent, i )
1470  {
1471  if ( Ent < i ) continue;
1472  assert( Ent == i );
1473  Vec_IntPushArray( vUnique, Vec_IntEntryP(vData, i*nIntSize), nIntSize );
1474  }
1475  assert( Vec_IntSize(vUnique) == nUnique * nIntSize );
1476  Vec_IntFree( vMap );
1477  return vUnique;
1478 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Vec_IntSize(Vec_Int_t *p)
Definition: vecInt.h:352
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecInt.h:88
static void Vec_IntPushArray(Vec_Int_t *p, int *pEntries, int nEntries)
Definition: vecInt.h:706
#define assert(ex)
Definition: util_old.h:213
static int * Vec_IntEntryP(Vec_Int_t *p, int i)
Definition: vecInt.h:417
static int Vec_IntUniqueCount(Vec_Int_t *vData, int nIntSize, Vec_Int_t **pvMap)
Definition: vecInt.h:1437
static void Vec_IntFree(Vec_Int_t *p)
Definition: vecInt.h:272
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static int Vec_IntUniqueCount ( Vec_Int_t vData,
int  nIntSize,
Vec_Int_t **  pvMap 
)
inlinestatic

Definition at line 1437 of file vecInt.h.

1438 {
1439  int nEntries = Vec_IntSize(vData) / nIntSize;
1440  int TableMask = (1 << Abc_Base2Log(nEntries)) - 1;
1441  int * pTable = ABC_FALLOC( int, TableMask+1 );
1442  int * pNexts = ABC_FALLOC( int, TableMask+1 );
1443  int * pClass = ABC_ALLOC( int, nEntries );
1444  int i, Key, * pEnt, nUnique = 0;
1445  assert( nEntries * nIntSize == Vec_IntSize(vData) );
1446  for ( i = 0; i < nEntries; i++ )
1447  {
1448  pEnt = Vec_IntEntryP( vData, i*nIntSize );
1449  Key = TableMask & Vec_IntUniqueHashKey( (unsigned char *)pEnt, 4*nIntSize );
1450  pEnt = Vec_IntUniqueLookup( vData, i, nIntSize, pNexts, pTable+Key );
1451  if ( *pEnt == -1 )
1452  *pEnt = i, nUnique++;
1453  pClass[i] = *pEnt;
1454  }
1455 // Vec_IntUniqueProfile( vData, pTable, pNexts, TableMask, nIntSize );
1456  ABC_FREE( pTable );
1457  ABC_FREE( pNexts );
1458  if ( pvMap )
1459  *pvMap = Vec_IntAllocArray( pClass, nEntries );
1460  else
1461  ABC_FREE( pClass );
1462  return nUnique;
1463 }
static int * Vec_IntUniqueLookup(Vec_Int_t *vData, int i, int nIntSize, int *pNexts, int *pStart)
Definition: vecInt.h:1429
static unsigned Vec_IntUniqueHashKey(unsigned char *pStr, int nChars)
Definition: vecInt.h:1411
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static int Vec_IntSize(Vec_Int_t *p)
Definition: vecInt.h:352
static Vec_Int_t * Vec_IntAllocArray(int *pArray, int nSize)
Definition: vecInt.h:171
#define ABC_FREE(obj)
Definition: abc_global.h:232
static int Abc_Base2Log(unsigned n)
Definition: abc_global.h:251
#define assert(ex)
Definition: util_old.h:213
static int * Vec_IntEntryP(Vec_Int_t *p, int i)
Definition: vecInt.h:417
#define ABC_FALLOC(type, num)
Definition: abc_global.h:231
static unsigned Vec_IntUniqueHashKey ( unsigned char *  pStr,
int  nChars 
)
inlinestatic

Definition at line 1411 of file vecInt.h.

1412 {
1413  static unsigned s_BigPrimes[16] =
1414  {
1415  0x984b6ad9,0x18a6eed3,0x950353e2,0x6222f6eb,0xdfbedd47,0xef0f9023,0xac932a26,0x590eaf55,
1416  0x97d0a034,0xdc36cd2e,0x22736b37,0xdc9066b0,0x2eb2f98b,0x5d9c7baf,0x85747c9e,0x8aca1055
1417  };
1418  static unsigned s_BigPrimes2[16] =
1419  {
1420  0x8d8a5ebe,0x1e6a15dc,0x197d49db,0x5bab9c89,0x4b55dea7,0x55dede49,0x9a6a8080,0xe5e51035,
1421  0xe148d658,0x8a17eb3b,0xe22e4b38,0xe5be2a9a,0xbe938cbb,0x3b981069,0x7f9c0c8e,0xf756df10
1422  };
1423  unsigned Key = 0; int c;
1424  for ( c = 0; c < nChars; c++ )
1425  Key += s_BigPrimes2[(2*c)&15] * s_BigPrimes[(unsigned)pStr[c] & 15] +
1426  s_BigPrimes2[(2*c+1)&15] * s_BigPrimes[(unsigned)pStr[c] >> 4];
1427  return Key;
1428 }
static unsigned Vec_IntUniqueHashKey2 ( unsigned char *  pStr,
int  nChars 
)
inlinestatic

Definition at line 1402 of file vecInt.h.

1403 {
1404  static unsigned s_BigPrimes[4] = {12582917, 25165843, 50331653, 100663319};
1405  unsigned Key = 0; int c;
1406  for ( c = 0; c < nChars; c++ )
1407  Key += (unsigned)pStr[c] * s_BigPrimes[c & 3];
1408  return Key;
1409 }
static unsigned Vec_IntUniqueHashKeyDebug ( unsigned char *  pStr,
int  nChars,
int  TableMask 
)
inlinestatic

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

Synopsis [Counts the number of unique entries.]

Description []

SideEffects []

SeeAlso []

Definition at line 1367 of file vecInt.h.

1368 {
1369  static unsigned s_BigPrimes[4] = {12582917, 25165843, 50331653, 100663319};
1370  unsigned Key = 0; int c;
1371  for ( c = 0; c < nChars; c++ )
1372  {
1373  Key += (unsigned)pStr[c] * s_BigPrimes[c & 3];
1374  printf( "%d : ", c );
1375  printf( "%3d ", pStr[c] );
1376  printf( "%12u ", Key );
1377  printf( "%12u ", Key&TableMask );
1378  printf( "\n" );
1379  }
1380  return Key;
1381 }
static int* Vec_IntUniqueLookup ( Vec_Int_t vData,
int  i,
int  nIntSize,
int *  pNexts,
int *  pStart 
)
inlinestatic

Definition at line 1429 of file vecInt.h.

1430 {
1431  int * pData = Vec_IntEntryP( vData, i*nIntSize );
1432  for ( ; *pStart != -1; pStart = pNexts + *pStart )
1433  if ( !memcmp( pData, Vec_IntEntryP(vData, *pStart*nIntSize), sizeof(int) * nIntSize ) )
1434  return pStart;
1435  return pStart;
1436 }
int memcmp()
static int * Vec_IntEntryP(Vec_Int_t *p, int i)
Definition: vecInt.h:417
static void Vec_IntUniqueProfile ( Vec_Int_t vData,
int *  pTable,
int *  pNexts,
int  TableMask,
int  nIntSize 
)
inlinestatic

Definition at line 1382 of file vecInt.h.

1383 {
1384  int i, Key, Counter;
1385  for ( i = 0; i <= TableMask; i++ )
1386  {
1387  Counter = 0;
1388  for ( Key = pTable[i]; Key != -1; Key = pNexts[Key] )
1389  Counter++;
1390  if ( Counter < 7 )
1391  continue;
1392  printf( "%d\n", Counter );
1393  for ( Key = pTable[i]; Key != -1; Key = pNexts[Key] )
1394  {
1395 // Extra_PrintBinary( stdout, (unsigned *)Vec_IntEntryP(vData, Key*nIntSize), 40 ), printf( "\n" );
1396 // Vec_IntUniqueHashKeyDebug( (unsigned char *)Vec_IntEntryP(vData, Key*nIntSize), 4*nIntSize, TableMask );
1397  }
1398  }
1399  printf( "\n" );
1400 }
static int Counter
static void Vec_IntUpdateEntry ( Vec_Int_t p,
int  i,
int  Value 
)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 468 of file vecInt.h.

469 {
470  if ( Vec_IntEntry( p, i ) < Value )
471  Vec_IntWriteEntry( p, i, Value );
472 }
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: vecInt.h:400
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: vecInt.h:434
static void Vec_IntWriteEntry ( Vec_Int_t p,
int  i,
int  Entry 
)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 434 of file vecInt.h.

435 {
436  assert( i >= 0 && i < p->nSize );
437  p->pArray[i] = Entry;
438 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntZero ( Vec_Int_t p)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 260 of file vecInt.h.

261 {
262  p->pArray = NULL;
263  p->nSize = 0;
264  p->nCap = 0;
265 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950