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

Go to the source code of this file.

Data Structures

struct  Vec_Set_t_
 

Macros

#define Vec_SetForEachEntry(Type, pVec, nSize, pSet, p, s)
 

Typedefs

typedef
typedefABC_NAMESPACE_HEADER_START
struct Vec_Set_t_ 
Vec_Set_t
 INCLUDES ///. More...
 

Functions

static int Vec_SetHandPage (Vec_Set_t *p, int h)
 MACRO DEFINITIONS ///. More...
 
static int Vec_SetHandShift (Vec_Set_t *p, int h)
 
static int Vec_SetWordNum (int nSize)
 
static wordVec_SetEntry (Vec_Set_t *p, int h)
 
static int Vec_SetEntryNum (Vec_Set_t *p)
 
static void Vec_SetWriteEntryNum (Vec_Set_t *p, int i)
 
static int Vec_SetLimit (word *p)
 
static int Vec_SetLimitS (word *p)
 
static int Vec_SetIncLimit (word *p, int nWords)
 
static int Vec_SetIncLimitS (word *p, int nWords)
 
static void Vec_SetWriteLimit (word *p, int nWords)
 
static void Vec_SetWriteLimitS (word *p, int nWords)
 
static int Vec_SetHandCurrent (Vec_Set_t *p)
 
static int Vec_SetHandCurrentS (Vec_Set_t *p)
 
static int Vec_SetHandMemory (Vec_Set_t *p, int h)
 
static int Vec_SetMemory (Vec_Set_t *p)
 
static int Vec_SetMemoryS (Vec_Set_t *p)
 
static int Vec_SetMemoryAll (Vec_Set_t *p)
 
static void Vec_SetAlloc_ (Vec_Set_t *p, int nPageSize)
 FUNCTION DEFINITIONS ///. More...
 
static Vec_Set_tVec_SetAlloc (int nPageSize)
 
static void Vec_SetRestart (Vec_Set_t *p)
 
static void Vec_SetFree_ (Vec_Set_t *p)
 
static void Vec_SetFree (Vec_Set_t *p)
 
static double Vec_ReportMemory (Vec_Set_t *p)
 
static int Vec_SetAppend (Vec_Set_t *p, int *pArray, int nSize)
 
static int Vec_SetAppendS (Vec_Set_t *p, int nSize)
 
static void Vec_SetShrink (Vec_Set_t *p, int h)
 
static void Vec_SetShrinkS (Vec_Set_t *p, int h)
 
static void Vec_SetShrinkLimits (Vec_Set_t *p)
 

Macro Definition Documentation

#define Vec_SetForEachEntry (   Type,
  pVec,
  nSize,
  pSet,
  p,
 
)
Value:
for ( p = 0; p <= pVec->iPage; p++ ) \
for ( s = 2; s < Vec_SetLimit(pVec->pPages[p]) && ((pSet) = (Type)(pVec->pPages[p] + (s))); s += nSize )
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_SetLimit(word *p)
Definition: vecSet.h:74

Definition at line 96 of file vecSet.h.

Typedef Documentation

typedef typedefABC_NAMESPACE_HEADER_START struct Vec_Set_t_ Vec_Set_t

INCLUDES ///.

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

FileName [vecSet.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [SAT solvers.]

Synopsis [Multi-page dynamic array.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]PARAMETERS ///BASIC TYPES ///

Definition at line 49 of file vecSet.h.

Function Documentation

static double Vec_ReportMemory ( Vec_Set_t p)
inlinestatic

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

Synopsis [Returns memory in bytes occupied by the vector.]

Description []

SideEffects []

SeeAlso []

Definition at line 194 of file vecSet.h.

195 {
196  double Mem = sizeof(Vec_Set_t);
197  Mem += p->nPagesAlloc * sizeof(void *);
198  Mem += sizeof(word) * (1 << p->nPageSize) * (1 + p->iPage);
199  return Mem;
200 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
typedefABC_NAMESPACE_HEADER_START struct Vec_Set_t_ Vec_Set_t
INCLUDES ///.
Definition: vecSet.h:49
static Vec_Set_t* Vec_SetAlloc ( int  nPageSize)
inlinestatic

Definition at line 128 of file vecSet.h.

129 {
130  Vec_Set_t * p;
131  p = ABC_CALLOC( Vec_Set_t, 1 );
132  Vec_SetAlloc_( p, nPageSize );
133  return p;
134 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_SetAlloc_(Vec_Set_t *p, int nPageSize)
FUNCTION DEFINITIONS ///.
Definition: vecSet.h:115
typedefABC_NAMESPACE_HEADER_START struct Vec_Set_t_ Vec_Set_t
INCLUDES ///.
Definition: vecSet.h:49
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
static void Vec_SetAlloc_ ( Vec_Set_t p,
int  nPageSize 
)
inlinestatic

FUNCTION DEFINITIONS ///.

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

Synopsis [Allocating vector.]

Description []

SideEffects []

SeeAlso []

Definition at line 115 of file vecSet.h.

116 {
117  assert( nPageSize > 8 );
118  memset( p, 0, sizeof(Vec_Set_t) );
119  p->nPageSize = nPageSize;
120  p->uPageMask = (unsigned)((1 << nPageSize) - 1);
121  p->nPagesAlloc = 256;
122  p->pPages = ABC_CALLOC( word *, p->nPagesAlloc );
123  p->pPages[0] = ABC_ALLOC( word, (1 << p->nPageSize) );
124  p->pPages[0][0] = ~0;
125  p->pPages[0][1] = ~0;
126  Vec_SetWriteLimit( p->pPages[0], 2 );
127 }
char * memset()
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
static void Vec_SetWriteLimit(word *p, int nWords)
Definition: vecSet.h:80
typedefABC_NAMESPACE_HEADER_START struct Vec_Set_t_ Vec_Set_t
INCLUDES ///.
Definition: vecSet.h:49
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define assert(ex)
Definition: util_old.h:213
static int Vec_SetAppend ( Vec_Set_t p,
int *  pArray,
int  nSize 
)
inlinestatic

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

Synopsis [Appending entries to vector.]

Description []

SideEffects []

SeeAlso []

Definition at line 213 of file vecSet.h.

214 {
215  int nWords = Vec_SetWordNum( nSize );
216  assert( nWords < (1 << p->nPageSize) );
217  p->nEntries++;
218  if ( Vec_SetLimit( p->pPages[p->iPage] ) + nWords >= (1 << p->nPageSize) )
219  {
220  if ( ++p->iPage == p->nPagesAlloc )
221  {
222  p->pPages = ABC_REALLOC( word *, p->pPages, p->nPagesAlloc * 2 );
223  memset( p->pPages + p->nPagesAlloc, 0, sizeof(word *) * p->nPagesAlloc );
224  p->nPagesAlloc *= 2;
225  }
226  if ( p->pPages[p->iPage] == NULL )
227  p->pPages[p->iPage] = ABC_ALLOC( word, (1 << p->nPageSize) );
228  Vec_SetWriteLimit( p->pPages[p->iPage], 2 );
229  p->pPages[p->iPage][1] = ~0;
230  }
231  if ( pArray )
232  memcpy( p->pPages[p->iPage] + Vec_SetLimit(p->pPages[p->iPage]), pArray, sizeof(int) * nSize );
233  Vec_SetIncLimit( p->pPages[p->iPage], nWords );
234  return Vec_SetHandCurrent(p) - nWords;
235 }
char * memset()
static int Vec_SetIncLimit(word *p, int nWords)
Definition: vecSet.h:77
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_REALLOC(type, obj, num)
Definition: abc_global.h:233
static int Vec_SetLimit(word *p)
Definition: vecSet.h:74
static int Vec_SetHandCurrent(Vec_Set_t *p)
Definition: vecSet.h:83
char * memcpy()
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
int nWords
Definition: abcNpn.c:127
static int Vec_SetWordNum(int nSize)
Definition: vecSet.h:67
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static void Vec_SetWriteLimit(word *p, int nWords)
Definition: vecSet.h:80
#define assert(ex)
Definition: util_old.h:213
static int Vec_SetAppendS ( Vec_Set_t p,
int  nSize 
)
inlinestatic

Definition at line 236 of file vecSet.h.

237 {
238  int nWords = Vec_SetWordNum( nSize );
239  assert( nWords < (1 << p->nPageSize) );
240  if ( Vec_SetLimitS( p->pPages[p->iPageS] ) + nWords >= (1 << p->nPageSize) )
241  Vec_SetWriteLimitS( p->pPages[++p->iPageS], 2 );
242  Vec_SetIncLimitS( p->pPages[p->iPageS], nWords );
243  return Vec_SetHandCurrentS(p) - nWords;
244 }
static void Vec_SetWriteLimitS(word *p, int nWords)
Definition: vecSet.h:81
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_SetLimitS(word *p)
Definition: vecSet.h:75
int nWords
Definition: abcNpn.c:127
static int Vec_SetWordNum(int nSize)
Definition: vecSet.h:67
static int Vec_SetHandCurrentS(Vec_Set_t *p)
Definition: vecSet.h:84
#define assert(ex)
Definition: util_old.h:213
static int Vec_SetIncLimitS(word *p, int nWords)
Definition: vecSet.h:78
static word* Vec_SetEntry ( Vec_Set_t p,
int  h 
)
inlinestatic

Definition at line 70 of file vecSet.h.

70 { return p->pPages[Vec_SetHandPage(p, h)] + Vec_SetHandShift(p, h); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_SetHandShift(Vec_Set_t *p, int h)
Definition: vecSet.h:66
static int Vec_SetHandPage(Vec_Set_t *p, int h)
MACRO DEFINITIONS ///.
Definition: vecSet.h:65
static int Vec_SetEntryNum ( Vec_Set_t p)
inlinestatic

Definition at line 71 of file vecSet.h.

71 { return p->nEntries; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_SetFree ( Vec_Set_t p)
inlinestatic

Definition at line 176 of file vecSet.h.

177 {
178  if ( p == NULL ) return;
179  Vec_SetFree_( p );
180  ABC_FREE( p );
181 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_SetFree_(Vec_Set_t *p)
Definition: vecSet.h:168
#define ABC_FREE(obj)
Definition: abc_global.h:232
static void Vec_SetFree_ ( Vec_Set_t p)
inlinestatic

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

Synopsis [Freeing vector.]

Description []

SideEffects []

SeeAlso []

Definition at line 168 of file vecSet.h.

169 {
170  int i;
171  if ( p == NULL ) return;
172  for ( i = 0; i < p->nPagesAlloc; i++ )
173  ABC_FREE( p->pPages[i] );
174  ABC_FREE( p->pPages );
175 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_FREE(obj)
Definition: abc_global.h:232
static int Vec_SetHandCurrent ( Vec_Set_t p)
inlinestatic

Definition at line 83 of file vecSet.h.

83 { return (p->iPage << p->nPageSize) + Vec_SetLimit(p->pPages[p->iPage]); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_SetLimit(word *p)
Definition: vecSet.h:74
static int Vec_SetHandCurrentS ( Vec_Set_t p)
inlinestatic

Definition at line 84 of file vecSet.h.

84 { return (p->iPageS << p->nPageSize) + Vec_SetLimitS(p->pPages[p->iPageS]); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_SetLimitS(word *p)
Definition: vecSet.h:75
static int Vec_SetHandMemory ( Vec_Set_t p,
int  h 
)
inlinestatic

Definition at line 86 of file vecSet.h.

86 { return Vec_SetHandPage(p, h) * (1 << (p->nPageSize+3)) + Vec_SetHandShift(p, h) * 8; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_SetHandShift(Vec_Set_t *p, int h)
Definition: vecSet.h:66
static int Vec_SetHandPage(Vec_Set_t *p, int h)
MACRO DEFINITIONS ///.
Definition: vecSet.h:65
static int Vec_SetHandPage ( Vec_Set_t p,
int  h 
)
inlinestatic

MACRO DEFINITIONS ///.

Definition at line 65 of file vecSet.h.

65 { return h >> p->nPageSize; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_SetHandShift ( Vec_Set_t p,
int  h 
)
inlinestatic

Definition at line 66 of file vecSet.h.

66 { return h & p->uPageMask; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_SetIncLimit ( word p,
int  nWords 
)
inlinestatic

Definition at line 77 of file vecSet.h.

77 { return p[0] += nWords; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nWords
Definition: abcNpn.c:127
static int Vec_SetIncLimitS ( word p,
int  nWords 
)
inlinestatic

Definition at line 78 of file vecSet.h.

78 { return p[1] += nWords; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nWords
Definition: abcNpn.c:127
static int Vec_SetLimit ( word p)
inlinestatic

Definition at line 74 of file vecSet.h.

74 { return p[0]; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_SetLimitS ( word p)
inlinestatic

Definition at line 75 of file vecSet.h.

75 { return p[1]; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_SetMemory ( Vec_Set_t p)
inlinestatic

Definition at line 87 of file vecSet.h.

static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_SetHandCurrent(Vec_Set_t *p)
Definition: vecSet.h:83
static int Vec_SetHandMemory(Vec_Set_t *p, int h)
Definition: vecSet.h:86
static int Vec_SetMemoryAll ( Vec_Set_t p)
inlinestatic

Definition at line 89 of file vecSet.h.

89 { return (p->iPage+1) * (1 << (p->nPageSize+3)); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_SetMemoryS ( Vec_Set_t p)
inlinestatic

Definition at line 88 of file vecSet.h.

static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_SetHandMemory(Vec_Set_t *p, int h)
Definition: vecSet.h:86
static int Vec_SetHandCurrentS(Vec_Set_t *p)
Definition: vecSet.h:84
static void Vec_SetRestart ( Vec_Set_t p)
inlinestatic

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

Synopsis [Resetting vector.]

Description []

SideEffects []

SeeAlso []

Definition at line 147 of file vecSet.h.

148 {
149  p->nEntries = 0;
150  p->iPage = 0;
151  p->iPageS = 0;
152  p->pPages[0][0] = ~0;
153  p->pPages[0][1] = ~0;
154  Vec_SetWriteLimit( p->pPages[0], 2 );
155 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_SetWriteLimit(word *p, int nWords)
Definition: vecSet.h:80
static void Vec_SetShrink ( Vec_Set_t p,
int  h 
)
inlinestatic

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

Synopsis [Shrinking vector size.]

Description []

SideEffects [This procedure does not update the number of entries.]

SeeAlso []

Definition at line 257 of file vecSet.h.

258 {
259  assert( h <= Vec_SetHandCurrent(p) );
260  p->iPage = Vec_SetHandPage(p, h);
261  Vec_SetWriteLimit( p->pPages[p->iPage], Vec_SetHandShift(p, h) );
262 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_SetHandCurrent(Vec_Set_t *p)
Definition: vecSet.h:83
static int Vec_SetHandShift(Vec_Set_t *p, int h)
Definition: vecSet.h:66
static int Vec_SetHandPage(Vec_Set_t *p, int h)
MACRO DEFINITIONS ///.
Definition: vecSet.h:65
static void Vec_SetWriteLimit(word *p, int nWords)
Definition: vecSet.h:80
#define assert(ex)
Definition: util_old.h:213
static void Vec_SetShrinkLimits ( Vec_Set_t p)
inlinestatic

Definition at line 270 of file vecSet.h.

271 {
272  int i;
273  for ( i = 0; i <= p->iPage; i++ )
274  Vec_SetWriteLimit( p->pPages[i], Vec_SetLimitS(p->pPages[i]) );
275 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_SetLimitS(word *p)
Definition: vecSet.h:75
static void Vec_SetWriteLimit(word *p, int nWords)
Definition: vecSet.h:80
static void Vec_SetShrinkS ( Vec_Set_t p,
int  h 
)
inlinestatic

Definition at line 263 of file vecSet.h.

264 {
265  assert( h <= Vec_SetHandCurrent(p) );
266  p->iPageS = Vec_SetHandPage(p, h);
267  Vec_SetWriteLimitS( p->pPages[p->iPageS], Vec_SetHandShift(p, h) );
268 }
static void Vec_SetWriteLimitS(word *p, int nWords)
Definition: vecSet.h:81
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_SetHandCurrent(Vec_Set_t *p)
Definition: vecSet.h:83
static int Vec_SetHandShift(Vec_Set_t *p, int h)
Definition: vecSet.h:66
static int Vec_SetHandPage(Vec_Set_t *p, int h)
MACRO DEFINITIONS ///.
Definition: vecSet.h:65
#define assert(ex)
Definition: util_old.h:213
static int Vec_SetWordNum ( int  nSize)
inlinestatic

Definition at line 67 of file vecSet.h.

67 { return (nSize + 1) >> 1; }
static void Vec_SetWriteEntryNum ( Vec_Set_t p,
int  i 
)
inlinestatic

Definition at line 72 of file vecSet.h.

72 { p->nEntries = i; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_SetWriteLimit ( word p,
int  nWords 
)
inlinestatic

Definition at line 80 of file vecSet.h.

80 { p[0] = nWords; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nWords
Definition: abcNpn.c:127
static void Vec_SetWriteLimitS ( word p,
int  nWords 
)
inlinestatic

Definition at line 81 of file vecSet.h.

81 { p[1] = nWords; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nWords
Definition: abcNpn.c:127