[commit: ghc] wip/alexbiehl: Use primops only (a8b3fe1)

git at git.haskell.org git at git.haskell.org
Thu Mar 23 20:02:00 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/alexbiehl
Link       : http://ghc.haskell.org/trac/ghc/changeset/a8b3fe11ae98a3b292eaadc38c92405f9128e3eb/ghc

>---------------------------------------------------------------

commit a8b3fe11ae98a3b292eaadc38c92405f9128e3eb
Author: alexbiehl <alex.biehl at gmail.com>
Date:   Thu Mar 23 21:01:47 2017 +0100

    Use primops only


>---------------------------------------------------------------

a8b3fe11ae98a3b292eaadc38c92405f9128e3eb
 compiler/utils/FastString.hs | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/compiler/utils/FastString.hs b/compiler/utils/FastString.hs
index 545bfd1..d55dee8 100644
--- a/compiler/utils/FastString.hs
+++ b/compiler/utils/FastString.hs
@@ -459,7 +459,11 @@ hashStr (Ptr a#) (I# len#) = loop 0# a#
   where
     !end = plusAddr# a# len# 
 
-    loop h op | isTrue# (eqAddr# op end) = I# h .&. (hASH_TBL_SIZE - 1)
+    loop h op | isTrue# (eqAddr# op end) = I# (word2Int#
+                                                (and#
+                                                  (int2Word# h)
+                                                  (minusWord#
+                                                    hASH_TBL_SIZE## 1##)))
               | otherwise = loop h' (plusAddr# op 1#)
             where 
                 !c  = ord# (indexCharOffAddr# op 0#)



More information about the ghc-commits mailing list