84 p->nStore = ((nObjs * (nAveSize + 1) + 16) / 4) * 4;
171 if ( --p->nRefs == 0 )
206 return sizeof(
Abc_Nam_t) + p->iHandle +
sizeof(
int) * p->nBins +
207 sizeof(int) * (p->vInt2Handle->nSize + p->vInt2Next->nSize);
225 return sizeof(
Abc_Nam_t) + p->nStore +
sizeof(
int) * p->nBins +
226 sizeof(int) * (p->vInt2Handle->nCap + p->vInt2Next->nCap);
242 static int s_FPrimes[128] = {
243 1009, 1049, 1093, 1151, 1201, 1249, 1297, 1361, 1427, 1459,
244 1499, 1559, 1607, 1657, 1709, 1759, 1823, 1877, 1933, 1997,
245 2039, 2089, 2141, 2213, 2269, 2311, 2371, 2411, 2467, 2543,
246 2609, 2663, 2699, 2741, 2797, 2851, 2909, 2969, 3037, 3089,
247 3169, 3221, 3299, 3331, 3389, 3461, 3517, 3557, 3613, 3671,
248 3719, 3779, 3847, 3907, 3943, 4013, 4073, 4129, 4201, 4243,
249 4289, 4363, 4441, 4493, 4549, 4621, 4663, 4729, 4793, 4871,
250 4933, 4973, 5021, 5087, 5153, 5227, 5281, 5351, 5417, 5471,
251 5519, 5573, 5651, 5693, 5749, 5821, 5861, 5923, 6011, 6073,
252 6131, 6199, 6257, 6301, 6353, 6397, 6481, 6563, 6619, 6689,
253 6737, 6803, 6863, 6917, 6977, 7027, 7109, 7187, 7237, 7309,
254 7393, 7477, 7523, 7561, 7607, 7681, 7727, 7817, 7877, 7933,
255 8011, 8039, 8059, 8081, 8093, 8111, 8123, 8147
260 for ( uHash = 0, i = 0; pStr+i < pLim; i++ )
262 uHash *= pStr[i] * s_FPrimes[i & 0x7F];
264 uHash ^= pStr[i] * s_FPrimes[i & 0x7F];
268 for ( uHash = 0, i = 0; pStr[i]; i++ )
270 uHash *= pStr[i] * s_FPrimes[i & 0x7F];
272 uHash ^= pStr[i] * s_FPrimes[i & 0x7F];
274 return uHash % nTableSize;
292 while ( pStr < pLim )
293 if ( *pStr++ != *pThis++ )
295 return *pThis !=
'\0';
300 if ( *pStr++ != *pThis++ )
302 return *pThis !=
'\0';
308 int * pPlace = (
int *)(p->pBins +
Abc_NamStrHash( pStr, pLim, p->nBins ));
333 int * piPlace, * pBinsOld, iHandleOld, i;
334 assert( p->pBins != NULL );
341 vInt2HandleOld = p->vInt2Handle;
396 if ( !(pStr[0] !=
'\\' || pStr[
strlen(pStr)-1] ==
' ') )
398 for ( i =
strlen(pStr) - 1; i >= 0; i-- )
412 iHandleNew = p->iHandle +
strlen(pStr) + 1;
413 while ( p->nStore < iHandleNew )
417 p->pStore =
ABC_REALLOC(
char, p->pStore, p->nStore );
419 assert( p->nStore >= iHandleNew );
425 p->iHandle = iHandleNew;
446 iHandleNew = p->iHandle + (pLim - pStr) + 1;
447 while ( p->nStore < iHandleNew )
451 p->pStore =
ABC_REALLOC(
char, p->pStore, p->nStore );
453 assert( p->nStore >= iHandleNew );
457 strncpy( pStore, pStr, pLim - pStr );
458 pStore[pLim - pStr] = 0;
461 p->iHandle = iHandleNew;
499 int * piPlace, iHandle1, i;
void Abc_NamStrHashResize(Abc_Nam_t *p)
static int Abc_PrimeCudd(unsigned int p)
void Abc_NamStop(Abc_Nam_t *p)
static int * Abc_NamStrHashFind(Abc_Nam_t *p, const char *pStr, const char *pLim)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
#define ABC_REALLOC(type, obj, num)
Abc_Nam_t * Abc_NamRef(Abc_Nam_t *p)
int Abc_NamObjNumMax(Abc_Nam_t *p)
static char * Abc_NamIntToStr(Abc_Nam_t *p, int i)
void Abc_NamPrint(Abc_Nam_t *p)
#define ABC_ALLOC(type, num)
int Abc_NamStrFindOrAdd(Abc_Nam_t *p, char *pStr, int *pfFound)
static Vec_Int_t * Vec_IntStartNatural(int nSize)
static int Abc_NamIntToHandle(Abc_Nam_t *p, int i)
Abc_Nam_t * Abc_NamStart(int nObjs, int nAveSize)
FUNCTION DEFINITIONS ///.
int Abc_NamStrFindOrAddLim(Abc_Nam_t *p, char *pStr, char *pLim, int *pfFound)
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
static Vec_Int_t * Vec_IntStart(int nSize)
static int Abc_NamIntToNext(Abc_Nam_t *p, int i)
int Abc_NamStrHash(const char *pStr, const char *pLim, int nTableSize)
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
int Abc_NamMemUsed(Abc_Nam_t *p)
Vec_Int_t * Abc_NamComputeIdMap(Abc_Nam_t *p1, Abc_Nam_t *p2)
static int Vec_IntEntry(Vec_Int_t *p, int i)
#define ABC_NAMESPACE_IMPL_END
static void Vec_IntPush(Vec_Int_t *p, int Entry)
int Abc_NamMemAlloc(Abc_Nam_t *p)
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
static void Abc_Print(int level, const char *format,...)
int Abc_NamStrFind(Abc_Nam_t *p, char *pStr)
char * Abc_NamStr(Abc_Nam_t *p, int NameId)
static char * Abc_NamHandleToStr(Abc_Nam_t *p, int h)
#define ABC_NAMESPACE_IMPL_START
static int Vec_IntSize(Vec_Int_t *p)
static int * Abc_NamIntToNextP(Abc_Nam_t *p, int i)
#define ABC_CALLOC(type, num)
typedefABC_NAMESPACE_HEADER_START struct Abc_Nam_t_ Abc_Nam_t
INCLUDES ///.
static int * Vec_IntEntryP(Vec_Int_t *p, int i)
int Abc_NamStrFindLim(Abc_Nam_t *p, char *pStr, char *pLim)
int Abc_NamReportCommon(Vec_Int_t *vNameIds1, Abc_Nam_t *p1, Abc_Nam_t *p2)
static void Vec_IntFree(Vec_Int_t *p)
static void Vec_IntClear(Vec_Int_t *p)
void Abc_NamDeref(Abc_Nam_t *p)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
char * Abc_NamReportUnique(Vec_Int_t *vNameIds1, Abc_Nam_t *p1, Abc_Nam_t *p2)
static int Abc_NamStrcmp(char *pStr, char *pLim, char *pThis)