i'# = word2Int# (int2Word# i# `and#` int2Word# (wsib -# 1#))
wsib = WORD_SIZE_IN_BITS# {- work around preprocessor problem (??) -}
bitSize _ = WORD_SIZE_IN_BITS
+
+ {-# INLINE shiftR #-}
+ -- same as the default definition, but we want it inlined (#2376)
+ x `shiftR` i = x `shift` (-i)
#else /* !__GLASGOW_HASKELL__ */
#ifdef __HUGS__
bitSize _ = 8
isSigned _ = True
+ {-# INLINE shiftR #-}
+ -- same as the default definition, but we want it inlined (#2376)
+ x `shiftR` i = x `shift` (-i)
+
{-# RULES
"fromIntegral/Int8->Int8" fromIntegral = id :: Int8 -> Int8
"fromIntegral/a->Int8" fromIntegral = \x -> case fromIntegral x of I# x# -> I8# (narrow8Int# x#)
bitSize _ = 16
isSigned _ = True
+ {-# INLINE shiftR #-}
+ -- same as the default definition, but we want it inlined (#2376)
+ x `shiftR` i = x `shift` (-i)
+
{-# RULES
"fromIntegral/Word8->Int16" fromIntegral = \(W8# x#) -> I16# (word2Int# x#)
"fromIntegral/Int8->Int16" fromIntegral = \(I8# x#) -> I16# x#
bitSize _ = 32
isSigned _ = True
+ {-# INLINE shiftR #-}
+ -- same as the default definition, but we want it inlined (#2376)
+ x `shiftR` i = x `shift` (-i)
+
{-# RULES
"fromIntegral/Int->Int32" fromIntegral = \(I# x#) -> I32# (intToInt32# x#)
"fromIntegral/Word->Int32" fromIntegral = \(W# x#) -> I32# (word32ToInt32# (wordToWord32# x#))
bitSize _ = 32
isSigned _ = True
+ {-# INLINE shiftR #-}
+ -- same as the default definition, but we want it inlined (#2376)
+ x `shiftR` i = x `shift` (-i)
+
{-# RULES
"fromIntegral/Word8->Int32" fromIntegral = \(W8# x#) -> I32# (word2Int# x#)
"fromIntegral/Word16->Int32" fromIntegral = \(W16# x#) -> I32# (word2Int# x#)
bitSize _ = 64
isSigned _ = True
+ {-# INLINE shiftR #-}
+ -- same as the default definition, but we want it inlined (#2376)
+ x `shiftR` i = x `shift` (-i)
+
-- give the 64-bit shift operations the same treatment as the 32-bit
-- ones (see GHC.Base), namely we wrap them in tests to catch the
bitSize _ = 64
isSigned _ = True
+ {-# INLINE shiftR #-}
+ -- same as the default definition, but we want it inlined (#2376)
+ x `shiftR` i = x `shift` (-i)
+
{-# RULES
"fromIntegral/a->Int64" fromIntegral = \x -> case fromIntegral x of I# x# -> I64# x#
"fromIntegral/Int64->a" fromIntegral = \(I64# x#) -> fromIntegral (I# x#)
bitSize _ = WORD_SIZE_IN_BITS
isSigned _ = False
+ {-# INLINE shiftR #-}
+ -- same as the default definition, but we want it inlined (#2376)
+ x `shiftR` i = x `shift` (-i)
+
{-# RULES
"fromIntegral/Int->Word" fromIntegral = \(I# x#) -> W# (int2Word# x#)
"fromIntegral/Word->Int" fromIntegral = \(W# x#) -> I# (word2Int# x#)
bitSize _ = 8
isSigned _ = False
+ {-# INLINE shiftR #-}
+ -- same as the default definition, but we want it inlined (#2376)
+ x `shiftR` i = x `shift` (-i)
+
{-# RULES
"fromIntegral/Word8->Word8" fromIntegral = id :: Word8 -> Word8
"fromIntegral/Word8->Integer" fromIntegral = toInteger :: Word8 -> Integer
bitSize _ = 16
isSigned _ = False
+ {-# INLINE shiftR #-}
+ -- same as the default definition, but we want it inlined (#2376)
+ x `shiftR` i = x `shift` (-i)
+
{-# RULES
"fromIntegral/Word8->Word16" fromIntegral = \(W8# x#) -> W16# x#
"fromIntegral/Word16->Word16" fromIntegral = id :: Word16 -> Word16
bitSize _ = 32
isSigned _ = False
+ {-# INLINE shiftR #-}
+ -- same as the default definition, but we want it inlined (#2376)
+ x `shiftR` i = x `shift` (-i)
+
{-# RULES
"fromIntegral/Int->Word32" fromIntegral = \(I# x#) -> W32# (int32ToWord32# (intToInt32# x#))
"fromIntegral/Word->Word32" fromIntegral = \(W# x#) -> W32# (wordToWord32# x#)
bitSize _ = 32
isSigned _ = False
+ {-# INLINE shiftR #-}
+ -- same as the default definition, but we want it inlined (#2376)
+ x `shiftR` i = x `shift` (-i)
+
{-# RULES
"fromIntegral/Word8->Word32" fromIntegral = \(W8# x#) -> W32# x#
"fromIntegral/Word16->Word32" fromIntegral = \(W16# x#) -> W32# x#
bitSize _ = 64
isSigned _ = False
+ {-# INLINE shiftR #-}
+ -- same as the default definition, but we want it inlined (#2376)
+ x `shiftR` i = x `shift` (-i)
+
-- give the 64-bit shift operations the same treatment as the 32-bit
-- ones (see GHC.Base), namely we wrap them in tests to catch the
-- cases when we're shifting more than 64 bits to avoid unspecified
bitSize _ = 64
isSigned _ = False
+ {-# INLINE shiftR #-}
+ -- same as the default definition, but we want it inlined (#2376)
+ x `shiftR` i = x `shift` (-i)
+
{-# RULES
"fromIntegral/a->Word64" fromIntegral = \x -> case fromIntegral x of W# x# -> W64# x#
"fromIntegral/Word64->a" fromIntegral = \(W64# x#) -> fromIntegral (W# x#)