projects
/
ghc-base.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fa403e0
)
Use shift[LR]Integer in the Bits Integer instance
author
Ian Lynagh
<igloo@earth.li>
Tue, 21 Jul 2009 22:24:40 +0000
(22:24 +0000)
committer
Ian Lynagh
<igloo@earth.li>
Tue, 21 Jul 2009 22:24:40 +0000
(22:24 +0000)
Data/Bits.hs
patch
|
blob
|
history
diff --git
a/Data/Bits.hs
b/Data/Bits.hs
index
46f009a
..
9b31397
100644
(file)
--- a/
Data/Bits.hs
+++ b/
Data/Bits.hs
@@
-48,7
+48,6
@@
module Data.Bits (
#ifdef __GLASGOW_HASKELL__
import GHC.Num
#ifdef __GLASGOW_HASKELL__
import GHC.Num
-import GHC.Real
import GHC.Base
#endif
import GHC.Base
#endif
@@
-292,8
+291,8
@@
instance Bits Integer where
complement a = -1 - a
#endif
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
rotate x i = shift x i -- since an Integer never wraps around