From bb1ac04ed36183ed0234b207d27283253275f62e Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Tue, 21 Jul 2009 22:24:40 +0000 Subject: [PATCH] Use shift[LR]Integer in the Bits Integer instance --- Data/Bits.hs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Data/Bits.hs b/Data/Bits.hs index 46f009a..9b31397 100644 --- a/Data/Bits.hs +++ b/Data/Bits.hs @@ -48,7 +48,6 @@ module Data.Bits ( #ifdef __GLASGOW_HASKELL__ import GHC.Num -import GHC.Real import GHC.Base #endif @@ -292,8 +291,8 @@ instance Bits Integer where complement a = -1 - a #endif - shift x i | i >= 0 = x * 2^i - | otherwise = x `div` 2^(-i) + 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 -- 1.7.10.4