Fix gratuitous breakage for non-GHC in Data.Bits.
authorMalcolm.Wallace@cs.york.ac.uk <unknown>
Fri, 9 Oct 2009 13:32:57 +0000 (13:32 +0000)
committerMalcolm.Wallace@cs.york.ac.uk <unknown>
Fri, 9 Oct 2009 13:32:57 +0000 (13:32 +0000)
Data/Bits.hs

index 9b31397..890909c 100644 (file)
@@ -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)"