From 518706bf6ec91ece77f2195cbb1361ebbc1972f0 Mon Sep 17 00:00:00 2001 From: Simon Peyton Jones Date: Thu, 13 Mar 2014 12:11:01 +0000 Subject: Add shiftR and shiftL implementations to instance Bits Integer Apart from simply making sense (avoid the conditional in 'shift'), this makes left and right shifts on Integer more likely to inline (plain 'shift' is just too large); and this in turn is important when fixing the Integer case of #8832 --- libraries/base/Data/Bits.hs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'libraries/base/Data/Bits.hs') diff --git a/libraries/base/Data/Bits.hs b/libraries/base/Data/Bits.hs index 28cd0241db..81b180bb7e 100644 --- a/libraries/base/Data/Bits.hs +++ b/libraries/base/Data/Bits.hs @@ -437,6 +437,9 @@ instance Bits Integer where complement = complementInteger shift x i@(I# i#) | i >= 0 = shiftLInteger x i# | otherwise = shiftRInteger x (negateInt# i#) + shiftL x (I# i#) = shiftLInteger x i# + shiftR x (I# i#) = shiftRInteger x i# + testBit x (I# i) = testBitInteger x i zeroBits = 0 -- cgit v1.2.1