#ifdef __GLASGOW_HASKELL__
import GHC.Num
-import GHC.Real
import GHC.Base
#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