Selaa lähdekoodia

* use proper value for Fnv64 initialization
* PPU version increased

florian 10 kuukautta sitten
vanhempi
commit
190b27ad45
4 muutettua tiedostoa jossa 13 lisäystä ja 6 poistoa
  1. 7 0
      compiler/fpchash.pas
  2. 1 1
      compiler/ncgvmt.pas
  3. 1 1
      compiler/ppu.pas
  4. 4 4
      compiler/symdef.pas

+ 7 - 0
compiler/fpchash.pas

@@ -33,6 +33,7 @@ function TrimStrCRC32(const s: ansistring; maxlen: longint): ansistring;
 { calculate string hash using FNV Hash:
   http://www.isthe.com/chongo/tech/comp/fnv/
 }
+function InitFnv64: uint64;
 function UpdateFnv64(const InitFnv: uint64; const InBuf; InLen: Integer): uint64;
 
 type
@@ -102,6 +103,12 @@ begin
    end;
 end;
 
+
+function InitFnv64: uint64;
+  begin
+    result:=uint64(14695981039346656037);
+  end;
+
 { calculate string hash using FNV Hash:
   http://www.isthe.com/chongo/tech/comp/fnv/
 }

+ 1 - 1
compiler/ncgvmt.pas

@@ -744,7 +744,7 @@ implementation
         tmpstr:=_class.objname^+'_$_'+make_mangledname('',realintfdef.owner,'')+'_$$_'+realintfdef.objname^+'_$_'+tostr(i)+'_$_'+pd.mangledname;
         if length(tmpstr)>50 then
           begin
-            hash:=0;
+            hash:=InitFnv64;
             hash:=UpdateFnv64(hash,tmpstr[51],length(tmpstr)-50);
             hs:=copy(tmpstr,1,50)+'$H'+Base64Mangle(hash);
           end

+ 1 - 1
compiler/ppu.pas

@@ -48,7 +48,7 @@ const
   CurrentPPUVersion = 208;
   { for any other changes to the ppu format, increase this version number
     (it's a cardinal) }
-  CurrentPPULongVersion = 24;
+  CurrentPPULongVersion = 25;
 
 { unit flags }
   uf_big_endian          = $000004;

+ 4 - 4
compiler/symdef.pas

@@ -1669,7 +1669,7 @@ implementation
                begin
                  if length(prefix)>(maxidlen-length(s)-1) then
                    begin
-                     hash:=0;
+                     hash:=InitFnv64;
                      hash:=UpdateFnv64(hash,prefix[1],length(prefix));
                      prefix:='$H'+Base64Mangle(hash);
                    end;
@@ -1686,7 +1686,7 @@ implementation
               internalerror(200204174);
              if length(prefix)>(maxidlen-length(tabstractrecorddef(st.defowner).objname^)-3) then
                begin
-                 hash:=0;
+                 hash:=InitFnv64;
                  hash:=UpdateFnv64(hash,prefix[1],length(prefix));
                  prefix:='$H'+Base64Mangle(hash);
                end;
@@ -1731,7 +1731,7 @@ implementation
           result:=result+'_$$_'+suffix;
         if length(result)>(maxidlen-1) then
           begin
-            hash:=0;
+            hash:=InitFnv64;
             hash:=UpdateFnv64(hash,result[1],length(result));
             result:=copy(result,1,maxidlen-(high(Base64OfUint64String)-low(Base64OfUint64String)+1)-2)+'$H'+Base64Mangle(hash);
           end;
@@ -5785,7 +5785,7 @@ implementation
         if (newlen-oldlen>12) and
            ((newlen>100) or (newlen-oldlen>64)) then
           begin
-            hash:=0;
+            hash:=InitFnv64;
             for i:=0 to paras.count-1 do
               begin
                 hp:=tparavarsym(paras[i]);