1.1 --- a/knight/shared/KeHashTable.cpp Wed Jan 28 02:14:41 2009 -0600
1.2 +++ b/knight/shared/KeHashTable.cpp Thu Jan 29 12:50:32 2009 -0500
1.3 @@ -1,3 +1,4 @@
1.4 +#include <string.h>
1.5 #include <KeHashTable.h>
1.6
1.7 using namespace Knight;
1.8 @@ -82,7 +83,7 @@
1.9 table->key_m = *key_marshal;
1.10 table->val_m = *val_marshal;
1.11 table->num_entries = 0;
1.12 - table->shift = bits;
1.13 + table->shift = 32 - bits;
1.14 table->node_alloc = nodeAlloc == NULL ? &s_DefHashAllocator : nodeAlloc;
1.15 table->num_buckets = (1 << bits);
1.16 table->grow_limit = (uint32_t)(0.9f * table->num_buckets);
1.17 @@ -145,7 +146,7 @@
1.18
1.19 /* Save new data */
1.20 table->num_buckets = (1 << new_shift);
1.21 - table->shift = new_shift;
1.22 + table->shift = 32 - new_shift;
1.23 table->grow_limit = (uint32_t)(0.9f * table->num_buckets);
1.24
1.25 table->buckets = (KeHashNode **)malloc(sizeof(KeHashNode *) * table->num_buckets);
1.26 @@ -407,3 +408,9 @@
1.27
1.28 return h;
1.29 }
1.30 +
1.31 +bool Knight::KE_AreStringsEqual(const void* str1, const void* str2)
1.32 +{
1.33 + return (strcmp((const char*)str1, (const char*)str2) == 0) ? true : false;
1.34 +}
1.35 +