[commit: ghc] master: Make Natural's (.|.) really an OR operation (#9818) (6b063ef)

git at git.haskell.org git at git.haskell.org
Tue Dec 2 16:51:44 UTC 2014


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/6b063ef2a1f68290b51778a38e9b89b6fec5e170/ghc

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

commit 6b063ef2a1f68290b51778a38e9b89b6fec5e170
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Tue Dec 2 17:51:36 2014 +0100

    Make Natural's (.|.) really an OR operation (#9818)
    
    Currently it's an AND when at least one of the operands is big.
    
    Reviewed By: hvr
    
    Differential Revision: https://phabricator.haskell.org/D549


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

6b063ef2a1f68290b51778a38e9b89b6fec5e170
 libraries/base/GHC/Natural.hs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libraries/base/GHC/Natural.hs b/libraries/base/GHC/Natural.hs
index 3519bcf..0211061 100644
--- a/libraries/base/GHC/Natural.hs
+++ b/libraries/base/GHC/Natural.hs
@@ -296,9 +296,9 @@ instance Bits Natural where
     NatJ# n .&. NatJ# m = bigNatToNatural (andBigNat n m)
 
     NatS# n .|. NatS# m = wordToNatural (W# n .|. W# m)
-    NatS# n .|. NatJ# m = NatJ# (andBigNat (wordToBigNat n) m)
-    NatJ# n .|. NatS# m = NatJ# (andBigNat n (wordToBigNat m))
-    NatJ# n .|. NatJ# m = NatJ# (andBigNat n m)
+    NatS# n .|. NatJ# m = NatJ# (orBigNat (wordToBigNat n) m)
+    NatJ# n .|. NatS# m = NatJ# (orBigNat n (wordToBigNat m))
+    NatJ# n .|. NatJ# m = NatJ# (orBigNat n m)
 
     NatS# n `xor` NatS# m = wordToNatural (W# n `xor` W# m)
     NatS# n `xor` NatJ# m = NatJ# (xorBigNat (wordToBigNat n) m)



More information about the ghc-commits mailing list