[commit: base] ghc-7.2: Sync the typeable fingerprinting with GHC (a64a658)
Ian Lynagh
igloo at earth.li
Sun Jul 24 20:26:12 CEST 2011
Repository : ssh://darcs.haskell.org//srv/darcs/packages/base
On branch : ghc-7.2
http://hackage.haskell.org/trac/ghc/changeset/a64a6582565dfd921682aa4d7b00fb9a51e6e366
>---------------------------------------------------------------
commit a64a6582565dfd921682aa4d7b00fb9a51e6e366
Author: Ian Lynagh <igloo at earth.li>
Date: Fri Jul 22 22:57:19 2011 +0100
Sync the typeable fingerprinting with GHC
>---------------------------------------------------------------
GHC/Fingerprint.hs | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/GHC/Fingerprint.hs b/GHC/Fingerprint.hs
index 817afa8..01a4c26 100644
--- a/GHC/Fingerprint.hs
+++ b/GHC/Fingerprint.hs
@@ -26,8 +26,6 @@ import GHC.List
import GHC.Real
import Foreign
import Foreign.C
-import GHC.IO.Encoding
-import GHC.Foreign
import GHC.Fingerprint.Type
@@ -54,10 +52,18 @@ fingerprintData buf len = do
c_MD5Final pdigest pctxt
peek (castPtr pdigest :: Ptr Fingerprint)
+-- This is duplicated in compiler/utils/Fingerprint.hsc
fingerprintString :: String -> Fingerprint
fingerprintString str = unsafeDupablePerformIO $
- GHC.Foreign.withCStringLen utf8 str $ \(p,len) ->
- fingerprintData (castPtr p) len
+ withArrayLen word8s $ \len p ->
+ fingerprintData p len
+ where word8s = concatMap f str
+ f c = let w32 :: Word32
+ w32 = fromIntegral (ord c)
+ in [fromIntegral (w32 `shiftR` 24),
+ fromIntegral (w32 `shiftR` 16),
+ fromIntegral (w32 `shiftR` 8),
+ fromIntegral w32]
data MD5Context
More information about the Cvs-libraries
mailing list