|
@@ -579,10 +579,10 @@ type
|
|
|
end;
|
|
|
|
|
|
|
|
|
- function FPHash(const s:shortstring):LongWord;
|
|
|
- function FPHash(P: PChar; Len: Integer): LongWord;
|
|
|
function FPHash(P: PChar; Len: Integer; Tag: LongWord): LongWord;
|
|
|
- function FPHash(const a:ansistring):LongWord;
|
|
|
+ function FPHash(P: PChar; Len: Integer): LongWord; inline;
|
|
|
+ function FPHash(const s:shortstring):LongWord; inline;
|
|
|
+ function FPHash(const a:ansistring):LongWord; inline;
|
|
|
|
|
|
|
|
|
implementation
|
|
@@ -1137,59 +1137,38 @@ end;
|
|
|
TFPHashList
|
|
|
*****************************************************************************}
|
|
|
|
|
|
- function FPHash(const s:shortstring):LongWord;
|
|
|
- Var
|
|
|
- p,pmax : pchar;
|
|
|
- begin
|
|
|
-{$push}
|
|
|
-{$q-,r-}
|
|
|
- result:=0;
|
|
|
- p:=@s[1];
|
|
|
- pmax:=@s[length(s)+1];
|
|
|
- while (p<pmax) do
|
|
|
- begin
|
|
|
- result:=LongWord(LongInt(result shl 5) - LongInt(result)) xor LongWord(P^);
|
|
|
- inc(p);
|
|
|
- end;
|
|
|
-{$pop}
|
|
|
- end;
|
|
|
-
|
|
|
- function FPHash(P: PChar; Len: Integer): LongWord;
|
|
|
- Var
|
|
|
- pmax : pchar;
|
|
|
- begin
|
|
|
-{$push}
|
|
|
-{$q-,r-}
|
|
|
- result:=0;
|
|
|
- pmax:=p+len;
|
|
|
- while (p<pmax) do
|
|
|
- begin
|
|
|
- result:=LongWord(LongInt(result shl 5) - LongInt(result)) xor LongWord(P^);
|
|
|
- inc(p);
|
|
|
- end;
|
|
|
-{$pop}
|
|
|
- end;
|
|
|
|
|
|
function FPHash(P: PChar; Len: Integer; Tag: LongWord): LongWord;
|
|
|
- Var
|
|
|
- pmax : pchar;
|
|
|
- begin
|
|
|
+ Var
|
|
|
+ pmax : pchar;
|
|
|
+ begin
|
|
|
{$push}
|
|
|
{$q-,r-}
|
|
|
- result:=Tag;
|
|
|
- pmax:=p+len;
|
|
|
- while (p<pmax) do
|
|
|
- begin
|
|
|
- result:=LongWord(LongInt(result shl 5) - LongInt(result)) xor LongWord(P^);
|
|
|
- inc(p);
|
|
|
- end;
|
|
|
+ result:=Tag;
|
|
|
+ pmax:=p+len;
|
|
|
+ while (p<pmax) do
|
|
|
+ begin
|
|
|
+ {DJBHash: result:=result*33 + next_char}
|
|
|
+ result:=LongWord(LongInt(result shl 5) + LongInt(result)) + LongWord(P^);
|
|
|
+ inc(p);
|
|
|
+ end;
|
|
|
{$pop}
|
|
|
- end;
|
|
|
+ end;
|
|
|
|
|
|
- function FPHash(const a: ansistring): LongWord;
|
|
|
- begin
|
|
|
- result:=fphash(pchar(a),length(a));
|
|
|
- end;
|
|
|
+ function FPHash(P: PChar; Len: Integer): LongWord; inline;
|
|
|
+ begin
|
|
|
+ result:=fphash(P,Len, 5381);
|
|
|
+ end;
|
|
|
+
|
|
|
+ function FPHash(const s: shortstring): LongWord; inline;
|
|
|
+ begin
|
|
|
+ result:=fphash(pchar(@s[1]),length(s));
|
|
|
+ end;
|
|
|
+
|
|
|
+ function FPHash(const a: ansistring): LongWord; inline;
|
|
|
+ begin
|
|
|
+ result:=fphash(pchar(a),length(a));
|
|
|
+ end;
|
|
|
|
|
|
|
|
|
procedure TFPHashList.RaiseIndexError(Index : Integer);
|