34 Key ^= ( Num & 0xFF) * 7937;
35 Key ^= ((Num >> 8) & 0xFF) * 2971;
36 Key ^= ((Num >> 16) & 0xFF) * 911;
37 Key ^= ((Num >> 24) & 0xFF) * 353;
38 return Key % TableSize;
45 1291, 1699, 2357, 4177, 5147,
46 5647, 6343, 7103, 7873, 8147
49 for ( i = 0; pName[i] !=
'\0'; i++ )
50 Key ^= s_Primes[i%10]*pName[i]*pName[i];
51 return Key % TableSize;
75 if ( p->nEntries > p->nBins * p->nSizeFactor )
79 ppSpot = p->pBinsI2N +
Nm_HashNumber(pEntry->ObjId, p->nBins);
80 pEntry->pNextI2N = *ppSpot;
86 pEntry->pNameSake = pOther->pNameSake? pOther->pNameSake : pOther;
87 pOther->pNameSake = pEntry;
93 pEntry->pNextN2I = *ppSpot;
120 while ( (*ppSpot)->ObjId != (
unsigned)ObjId )
121 ppSpot = &(*ppSpot)->pNextI2N;
123 *ppSpot = (*ppSpot)->pNextI2N;
125 ppSpot = p->pBinsN2I +
Nm_HashString(pEntry->Name, p->nBins);
126 while ( *ppSpot && *ppSpot != pEntry )
127 ppSpot = &(*ppSpot)->pNextN2I;
129 fRemoved = (*ppSpot != NULL);
132 assert( *ppSpot == pEntry );
133 *ppSpot = (*ppSpot)->pNextN2I;
136 if ( pEntry->pNameSake == NULL )
142 assert( pEntry->pNameSake != pEntry );
143 for ( pPrev = pEntry; pPrev->pNameSake != pEntry; pPrev = pPrev->pNameSake );
145 assert( pPrev->pNameSake == pEntry );
146 if ( pEntry->pNameSake == pPrev )
147 pPrev->pNameSake = NULL;
149 pPrev->pNameSake = pEntry->pNameSake;
153 assert( pPrev->pNextN2I == NULL );
154 pPrev->pNextN2I = *ppSpot;
174 for ( pEntry = p->pBinsI2N[
Nm_HashNumber(ObjId, p->nBins) ]; pEntry; pEntry = pEntry->pNextI2N )
175 if ( pEntry->ObjId == (
unsigned)ObjId )
194 for ( pEntry = p->pBinsN2I[
Nm_HashString(pName, p->nBins) ]; pEntry; pEntry = pEntry->pNextN2I )
197 if ( !
strcmp(pEntry->Name, pName) && (Type == -1 || pEntry->Type == (
unsigned)Type) )
200 if ( pEntry->pNameSake == NULL )
203 for ( pTemp = pEntry->pNameSake; pTemp != pEntry; pTemp = pTemp->pNameSake )
204 if ( !
strcmp(pTemp->Name, pName) && (Type == -1 || pTemp->Type == (
unsigned)Type) )
225 printf(
"I2N table: " );
226 for ( e = 0; e < p->nBins; e++ )
229 for ( pEntry = p->pBinsI2N[e]; pEntry; pEntry = pEntry->pNextI2N )
231 printf(
"%d ", Counter );
234 printf(
"N2I table: " );
235 for ( e = 0; e < p->nBins; e++ )
238 for ( pEntry = p->pBinsN2I[e]; pEntry; pEntry = pEntry->pNextN2I )
240 printf(
"%d ", Counter );
258 Nm_Entry_t ** pBinsNewI2N, ** pBinsNewN2I, * pEntry, * pEntry2, ** ppSpot;
272 for ( e = 0; e < p->nBins; e++ )
273 for ( pEntry = p->pBinsI2N[e], pEntry2 = pEntry? pEntry->pNextI2N : NULL;
274 pEntry; pEntry = pEntry2, pEntry2 = pEntry? pEntry->pNextI2N : NULL )
276 ppSpot = pBinsNewI2N +
Nm_HashNumber(pEntry->ObjId, nBinsNew);
277 pEntry->pNextI2N = *ppSpot;
282 for ( e = 0; e < p->nBins; e++ )
283 for ( pEntry = p->pBinsN2I[e], pEntry2 = pEntry? pEntry->pNextN2I : NULL;
284 pEntry; pEntry = pEntry2, pEntry2 = pEntry? pEntry->pNextN2I : NULL )
286 ppSpot = pBinsNewN2I +
Nm_HashString(pEntry->Name, nBinsNew);
287 pEntry->pNextN2I = *ppSpot;
290 assert( Counter == p->nEntries );
296 p->pBinsI2N = pBinsNewI2N;
297 p->pBinsN2I = pBinsNewN2I;
static int Abc_PrimeCudd(unsigned int p)
int Nm_ManTableAdd(Nm_Man_t *p, Nm_Entry_t *pEntry)
FUNCTION DEFINITIONS ///.
int Nm_ManTableDelete(Nm_Man_t *p, int ObjId)
Nm_Entry_t * Nm_ManTableLookupName(Nm_Man_t *p, char *pName, int Type)
typedefABC_NAMESPACE_HEADER_START struct Nm_Entry_t_ Nm_Entry_t
INCLUDES ///.
#define ABC_ALLOC(type, num)
static abctime Abc_Clock()
Nm_Entry_t * Nm_ManTableLookupId(Nm_Man_t *p, int ObjId)
static int s_Primes[MAX_PRIMES]
#define ABC_NAMESPACE_IMPL_END
typedefABC_NAMESPACE_HEADER_START struct Nm_Man_t_ Nm_Man_t
INCLUDES ///.
void Nm_ManProfile(Nm_Man_t *p)
#define ABC_NAMESPACE_IMPL_START
static void Nm_ManResize(Nm_Man_t *p)
static unsigned Nm_HashString(char *pName, int TableSize)
static ABC_NAMESPACE_IMPL_START unsigned Nm_HashNumber(int Num, int TableSize)
DECLARATIONS ///.