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:
c72dc99
)
Fix gratuitous breakage for non-GHC in Data.Bits.
author
Malcolm.Wallace@cs.york.ac.uk
<unknown>
Fri, 9 Oct 2009 13:32:57 +0000
(13:32 +0000)
committer
Malcolm.Wallace@cs.york.ac.uk
<unknown>
Fri, 9 Oct 2009 13:32:57 +0000
(13:32 +0000)
Data/Bits.hs
patch
|
blob
|
history
diff --git
a/Data/Bits.hs
b/Data/Bits.hs
index
9b31397
..
890909c
100644
(file)
--- a/
Data/Bits.hs
+++ b/
Data/Bits.hs
@@
-273,6
+273,8
@@
instance Bits Integer where
(.|.) = orInteger
xor = xorInteger
complement = complementInteger
(.|.) = 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
#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
-- assuming infinite 2's-complement arithmetic
complement a = -1 - a
+ shift x i | i >= 0 = x * 2^i
+ | otherwise = x `div` 2^(-i)
#endif
#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)"
rotate x i = shift x i -- since an Integer never wraps around
bitSize _ = error "Data.Bits.bitSize(Integer)"