* since T(Tag)HashSet always forces the size to a power of 2, use "and"

rather than "mod" to select the hash bucket

git-svn-id: trunk@32055 -
This commit is contained in:
Jonas Maebe 2015-10-14 16:44:02 +00:00
parent 9431648b6c
commit 231039b224

View File

@ -2881,7 +2881,7 @@ end;
h: LongWord;
begin
h := FPHash(Key, KeyLen);
Entry := @FBucket[h mod FBucketCount];
Entry := @FBucket[h and (FBucketCount-1)];
while Assigned(Entry^) and
not ((Entry^^.HashValue = h) and (Entry^^.KeyLength = KeyLen) and
(CompareByte(Entry^^.Key^, Key^, KeyLen) = 0)) do
@ -2930,7 +2930,7 @@ end;
e := FBucket[i];
while Assigned(e) do
begin
chain := @p[e^.HashValue mod NewCapacity];
chain := @p[e^.HashValue and (NewCapacity-1)];
n := e^.Next;
e^.Next := chain^;
chain^ := e;
@ -2988,7 +2988,7 @@ end;
h: LongWord;
begin
h := FPHash(Key, KeyLen, Tag);
Entry := @PPTagHashSetItem(FBucket)[h mod FBucketCount];
Entry := @PPTagHashSetItem(FBucket)[h and (FBucketCount-1)];
while Assigned(Entry^) and
not ((Entry^^.HashValue = h) and (Entry^^.KeyLength = KeyLen) and
(Entry^^.Tag = Tag) and (CompareByte(Entry^^.Key^, Key^, KeyLen) = 0)) do