From 21081676e9c7d88912a98ce6424b75200a6699b9 Mon Sep 17 00:00:00 2001 From: "Malcolm.Wallace@cs.york.ac.uk" Date: Fri, 9 Oct 2009 13:32:57 +0000 Subject: [PATCH] Fix gratuitous breakage for non-GHC in Data.Bits. --- Data/Bits.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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)" -- 1.7.10.4