version 1.4, 2001/04/27 22:28:32
|
version 1.6, 2001/04/29 18:57:33
|
|
|
{ | { |
Uint32 h = 0; | Uint32 h = 0; |
| |
for (Uint32 i = 0, n = str.getLength(); i < n; i++) |
for (Uint32 i = 0, n = str.size(); i < n; i++) |
h = 5 * h + str[i]; | h = 5 * h + str[i]; |
| |
return h; | return h; |
|
|
Uint32 i = hashCode % _numChains; | Uint32 i = hashCode % _numChains; |
_BucketBase* last = 0; | _BucketBase* last = 0; |
| |
for (_BucketBase* bucket = _chains[i]; bucket; bucket = bucket->next) |
for (_BucketBase* b = _chains[i]; b; b = b->next) |
{ | { |
if (bucket->equal(key)) |
if (b->equal(key)) |
{ | { |
delete bucket; | delete bucket; |
return false; | return false; |
} | } |
| |
last = bucket; |
last = b; |
} | } |
| |
// Insert bucket: | // Insert bucket: |