[commit: packages/integer-simple] master: Use a more sensible `hashInteger` implementation (9e8b924)

git at git.haskell.org git at git.haskell.org
Fri Jan 3 11:06:10 UTC 2014


Repository : ssh://git@git.haskell.org/integer-simple

On branch  : master
Link       : http://git.haskell.org/packages/integer-simple.git/commitdiff/9e8b924f68c4cdb6c7ae88f274baa3560aaa305e

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

commit 9e8b924f68c4cdb6c7ae88f274baa3560aaa305e
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Fri Jan 3 12:04:27 2014 +0100

    Use a more sensible `hashInteger` implementation
    
    This makes `hashInteger` behave the same way as `integer-gmp`s
    `hashInteger`.
    
    Signed-off-by: Herbert Valerio Riedel <hvr at gnu.org>


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

9e8b924f68c4cdb6c7ae88f274baa3560aaa305e
 GHC/Integer/Type.hs |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/GHC/Integer/Type.hs b/GHC/Integer/Type.hs
index 144a52c..5deecd2 100644
--- a/GHC/Integer/Type.hs
+++ b/GHC/Integer/Type.hs
@@ -503,10 +503,9 @@ signumInteger (Negative _) = negativeOneInteger
 signumInteger Naught       = Naught
 signumInteger (Positive _) = oneInteger
 
--- XXX This isn't a great hash function
 {-# NOINLINE hashInteger #-}
 hashInteger :: Integer -> Int#
-hashInteger (!_) = 42#
+hashInteger = integerToInt
 
 -------------------------------------------------------------------
 -- The hard work is done on positive numbers



More information about the ghc-commits mailing list