[MLton-commit] r7336

Wesley Terpstra wesley at mlton.org
Sun Nov 1 16:12:47 PST 2009


MLton.hash is useless. Use a generic brain-dead hash instead.


----------------------------------------------------------------------

U   mlton/trunk/package/mingw/dirs2wix.sml
U   mlton/trunk/package/mingw/files2cmp.sml
U   mlton/trunk/package/mingw/files2wix.sml

----------------------------------------------------------------------

Modified: mlton/trunk/package/mingw/dirs2wix.sml
===================================================================
--- mlton/trunk/package/mingw/dirs2wix.sml	2009-11-01 23:55:45 UTC (rev 7335)
+++ mlton/trunk/package/mingw/dirs2wix.sml	2009-11-02 00:12:46 UTC (rev 7336)
@@ -8,8 +8,9 @@
    \  </Fragment>\n\
    \</Wix>\n"
 
+fun hash (c, w) = w * 0w5746711073709751657 + Word64.fromInt (Char.ord c)
 fun alnum c = if Char.isAlphaNum c orelse c = #"." then c else #"_"
-fun escape s = Word32.toString (MLton.hash s) ^ "." ^ 
+fun escape s = Word64.toString (foldl hash 0w0 (explode s)) ^ "." ^ 
                (CharVector.map alnum (#file (OS.Path.splitDirFile s)))
 
 val depth = ref 3

Modified: mlton/trunk/package/mingw/files2cmp.sml
===================================================================
--- mlton/trunk/package/mingw/files2cmp.sml	2009-11-01 23:55:45 UTC (rev 7335)
+++ mlton/trunk/package/mingw/files2cmp.sml	2009-11-02 00:12:46 UTC (rev 7336)
@@ -14,8 +14,9 @@
    \  </Fragment>\n\
    \</Wix>\n"
 
+fun hash (c, w) = w * 0w5746711073709751657 + Word64.fromInt (Char.ord c)
 fun alnum c = if Char.isAlphaNum c orelse c = #"." then c else #"_"
-fun escape s = Word32.toString (MLton.hash s) ^ "." ^ 
+fun escape s = Word64.toString (foldl hash 0w0 (explode s)) ^ "." ^ 
                (CharVector.map alnum (#file (OS.Path.splitDirFile s)))
 
 fun component path = 

Modified: mlton/trunk/package/mingw/files2wix.sml
===================================================================
--- mlton/trunk/package/mingw/files2wix.sml	2009-11-01 23:55:45 UTC (rev 7335)
+++ mlton/trunk/package/mingw/files2wix.sml	2009-11-02 00:12:46 UTC (rev 7336)
@@ -6,8 +6,9 @@
    \  </Fragment>\n\
    \</Wix>\n"
 
+fun hash (c, w) = w * 0w5746711073709751657 + Word64.fromInt (Char.ord c)
 fun alnum c = if Char.isAlphaNum c orelse c = #"." then c else #"_"
-fun escape s = Word32.toString (MLton.hash s) ^ "." ^ 
+fun escape s = Word64.toString (foldl hash 0w0 (explode s)) ^ "." ^ 
                (CharVector.map alnum (#file (OS.Path.splitDirFile s)))
 
 fun dirEntry path =




More information about the MLton-commit mailing list