# HG changeset patch # User Nina Engelhardt # Date 1366814119 -7200 # Node ID bd376656f8ab62a21bccf1ba2991b2d3a0d57dc4 # Parent 18a72865dd78f313ff48f1462b7dd612cbf1f15a assuming you were not having fun thinking up silly ways to write 0 diff -r 18a72865dd78 -r bd376656f8ab PrivateHash.c --- a/PrivateHash.c Wed Mar 06 14:35:01 2013 +0100 +++ b/PrivateHash.c Wed Apr 24 16:35:19 2013 +0200 @@ -329,7 +329,7 @@ retTable = VMS_int__malloc( sizeof( HashTable ) ); numHashSlots = 1 << powerOf2OfSz; - retTable->hashMask = 0xffffffff >> 32 - powerOf2OfSz; + retTable->hashMask = 0xffffffff >> (32 - powerOf2OfSz); retTable->prevHash = (int32)rand(); retTable->freeEntryContentFn = freeFn; @@ -372,7 +372,7 @@ testEntry = getEntryFromTable32( (uint32 *)entry->key, table ); if( testEntry == NULL ) //no entry w/key, so add passed-in as list-head - { hashIdx = hashThisKey32( entry->key, table->tableSz ); + { hashIdx = hashThisKey32( (uint32 *)entry->key, table ); entry->next = (table->entries)[hashIdx]; (table->entries)[hashIdx] = entry; table->numEntries += 1; diff -r 18a72865dd78 -r bd376656f8ab PrivateHash.h --- a/PrivateHash.h Wed Mar 06 14:35:01 2013 +0100 +++ b/PrivateHash.h Wed Apr 24 16:35:19 2013 +0200 @@ -80,6 +80,7 @@ void *getValueFromTable32( uint32 key[], HashTable *table ); bool32 deleteEntryFromTable32( uint32 key[], HashTable *table ); +int32 hashThisKey32( uint32 *key, HashTable *hashTable ); //=========================================================================== // Internal functions