summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralexbiehl <alex.biehl@gmail.com>2017-03-23 21:01:47 +0100
committeralexbiehl <alex.biehl@gmail.com>2017-03-23 21:01:47 +0100
commita8b3fe11ae98a3b292eaadc38c92405f9128e3eb (patch)
tree895a65d1f8f907bbf950dcf144f8bcbbc36f98ee
parent73656e67d777e942b4e977f25cf803959ae4433f (diff)
downloadhaskell-wip/alexbiehl.tar.gz
Use primops onlywip/alexbiehl
-rw-r--r--compiler/utils/FastString.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/utils/FastString.hs b/compiler/utils/FastString.hs
index 545bfd122f..d55dee834b 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#)