From: Malcolm.Wallace@cs.york.ac.uk Date: Fri, 9 Oct 2009 13:32:57 +0000 (+0000) Subject: Fix gratuitous breakage for non-GHC in Data.Bits. X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=21081676e9c7d88912a98ce6424b75200a6699b9;p=ghc-base.git Fix gratuitous breakage for non-GHC in Data.Bits. --- diff --git a/Data/Bits.hs b/Data/Bits.hs index 9b31397..890909c 100644 --- a/Data/Bits.hs +++ b/Data/Bits.hs @@ -273,6 +273,8 @@ instance Bits Integer where (.|.) = orInteger xor = xorInteger complement = complementInteger + shift x i@(I# i#) | i >= 0 = shiftLInteger x i# + | otherwise = shiftRInteger x (negateInt# i#) #else -- reduce bitwise binary operations to special cases we can handle @@ -289,11 +291,10 @@ instance Bits Integer where -- assuming infinite 2's-complement arithmetic complement a = -1 - a + shift x i | i >= 0 = x * 2^i + | otherwise = x `div` 2^(-i) #endif - shift x i@(I# i#) | i >= 0 = shiftLInteger x i# - | otherwise = shiftRInteger x (negateInt# i#) - rotate x i = shift x i -- since an Integer never wraps around bitSize _ = error "Data.Bits.bitSize(Integer)"