summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6d6df4e)
raw | patch | inline | side by side (parent: 6d6df4e)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Wed, 30 Aug 2017 02:47:39 +0000 (05:47 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Wed, 30 Aug 2017 02:48:57 +0000 (05:48 +0300) |
src/shared/hashtable.pas | patch | blob | history |
index f3331d816e68d994a3bd234972172c3733184554..531b3a3b71212661ee5db77d70898c33617d20eb 100644 (file)
--- a/src/shared/hashtable.pas
+++ b/src/shared/hashtable.pas
type
THashIntInt = specialize THashBase<Integer, Integer>;
+ THashStrInt = specialize THashBase<AnsiString, Integer>;
function hashNewIntInt (): THashIntInt;
+function hashNewStrInt (): THashStrInt;
function u32Hash (a: LongWord): LongWord; inline;
// ////////////////////////////////////////////////////////////////////////// //
function hiiequ (constref a, b: Integer): Boolean; begin result := (a = b); end;
+function hsiequ (constref a, b: AnsiString): Boolean; begin result := (a = b); end;
{$PUSH}
{$RANGECHECKS OFF}
result := result xor (result shl 10);
result := result xor (result shr 15);
end;
+
+function hsihash (constref k: AnsiString): LongWord;
+begin
+ if (Length(k) > 0) then result := fnvHash(PAnsiChar(k)^, Length(k)) else result := 0;
+end;
{$POP}
end;
+function hashNewStrInt (): THashStrInt;
+begin
+ result := THashStrInt.Create(hsihash, hsiequ);
+end;
+
+
// ////////////////////////////////////////////////////////////////////////// //
{$PUSH}
{$RANGECHECKS OFF}