[commit: ghc] master: Call `popCountBigNat` directly (#9818) (96d29b5)

git at git.haskell.org git at git.haskell.org
Sat Nov 22 14:20:57 UTC 2014


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/96d29b5403bd8a6465a65a39da861f5b9610fc89/ghc

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

commit 96d29b5403bd8a6465a65a39da861f5b9610fc89
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Sat Nov 22 15:09:46 2014 +0100

    Call `popCountBigNat` directly (#9818)
    
    This calls the `popCountBigNat` primitive directly instead of going
    through `Integer`'s `popCount`.


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

96d29b5403bd8a6465a65a39da861f5b9610fc89
 libraries/base/GHC/Natural.hs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libraries/base/GHC/Natural.hs b/libraries/base/GHC/Natural.hs
index 3adfd40..e9b37b1 100644
--- a/libraries/base/GHC/Natural.hs
+++ b/libraries/base/GHC/Natural.hs
@@ -332,7 +332,7 @@ instance Bits Natural where
     rotateR = shiftR
 
     popCount (NatS# w)  = popCount (W# w)
-    popCount (NatJ# bn) = popCount (Jp# bn)
+    popCount (NatJ# bn) = I# (popCountBigNat bn)
 
     zeroBits = NatS# 0##
 



More information about the ghc-commits mailing list