mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 17:19:19 +02:00
+ Added computehashvalue
This commit is contained in:
parent
315bb3b1a6
commit
d21b73460a
@ -40,9 +40,26 @@ unit cresstr;
|
|||||||
{ calcs the hash value for a give resourcestring, len is }
|
{ calcs the hash value for a give resourcestring, len is }
|
||||||
{ necessary because the resourcestring can contain #0 }
|
{ necessary because the resourcestring can contain #0 }
|
||||||
function calc_resstring_hashvalue(p : pchar;len : longint) : longint;
|
function calc_resstring_hashvalue(p : pchar;len : longint) : longint;
|
||||||
|
|
||||||
|
Var hash,g,I : longint;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
calc_resstring_hashvalue:=12345678;
|
hash:=len;
|
||||||
|
For I:=0 to Len-1 do
|
||||||
|
begin
|
||||||
|
hash:=hash shl 4;
|
||||||
|
inc(Hash,Ord(p[i]));
|
||||||
|
g:=hash and ($f shl 28);
|
||||||
|
if g<>0 then
|
||||||
|
begin
|
||||||
|
hash:=hash xor (g shr 24);
|
||||||
|
hash:=hash xor g;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
If Hash=0 then
|
||||||
|
Calc_resstring_hashvalue:=Not(0)
|
||||||
|
else
|
||||||
|
calc_resstring_hashvalue:=Hash;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure insertresourcestrings;
|
procedure insertresourcestrings;
|
||||||
@ -102,7 +119,10 @@ unit cresstr;
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.1 1999-07-22 09:34:04 florian
|
Revision 1.2 1999-07-22 20:04:58 michael
|
||||||
|
+ Added computehashvalue
|
||||||
|
|
||||||
|
Revision 1.1 1999/07/22 09:34:04 florian
|
||||||
+ initial revision
|
+ initial revision
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user