diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2006-07-23 08:01:00 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2006-07-23 08:01:00 -0700 |
commit | 7e8e03206c56e7cd9d0d9fbb447c785c400ff3ee (patch) | |
tree | 9d31935cf6c27b36c3ceb57cb5cffe2577a569a7 /src/misc/nm/nmTable.c | |
parent | 616bb095f10c24f1f720efe89b7f39c670d114a3 (diff) | |
download | abc-7e8e03206c56e7cd9d0d9fbb447c785c400ff3ee.tar.gz abc-7e8e03206c56e7cd9d0d9fbb447c785c400ff3ee.tar.bz2 abc-7e8e03206c56e7cd9d0d9fbb447c785c400ff3ee.zip |
Version abc60723
Diffstat (limited to 'src/misc/nm/nmTable.c')
-rw-r--r-- | src/misc/nm/nmTable.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/misc/nm/nmTable.c b/src/misc/nm/nmTable.c index 86c520d8..65f16e04 100644 --- a/src/misc/nm/nmTable.c +++ b/src/misc/nm/nmTable.c @@ -44,7 +44,7 @@ static unsigned Nm_HashString( char * pName, int TableSize ) }; unsigned i, Key = 0; for ( i = 0; pName[i] != '\0'; i++ ) - Key ^= s_Primes[i%10]*pName[i]; + Key ^= s_Primes[i%10]*pName[i]*pName[i]; return Key % TableSize; } @@ -142,7 +142,7 @@ Nm_Entry_t * Nm_ManTableLookupId( Nm_Man_t * p, int ObjId ) Nm_Entry_t * Nm_ManTableLookupName( Nm_Man_t * p, char * pName, Nm_Entry_t ** ppSecond ) { Nm_Entry_t * pFirst, * pSecond; - int i; + int i, Counter = 0; pFirst = pSecond = NULL; for ( i = Nm_HashString(pName, p->nBins); p->pBinsN2I[i]; i = (i+1) % p->nBins ) if ( strcmp(p->pBinsN2I[i]->Name, pName) == 0 ) @@ -154,6 +154,10 @@ Nm_Entry_t * Nm_ManTableLookupName( Nm_Man_t * p, char * pName, Nm_Entry_t ** pp else assert( 0 ); // name appears more than 2 times } + else + Counter++; + if ( Counter > 100 ) + printf( "%d ", Counter ); // save the names if ( ppSecond ) *ppSecond = pSecond; |