From fb1032bc3dd243f04a6d7ca8026973a1f2d2a6a3 Mon Sep 17 00:00:00 2001 From: sof Date: Thu, 2 Jul 1998 13:53:58 +0000 Subject: [PATCH] [project @ 1998-07-02 13:53:58 by sof] shift right: iShiftRA# expects shift length to be >=0 --- ghc/lib/exts/Int.lhs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ghc/lib/exts/Int.lhs b/ghc/lib/exts/Int.lhs index 8f8a352..88d6b44 100644 --- a/ghc/lib/exts/Int.lhs +++ b/ghc/lib/exts/Int.lhs @@ -203,7 +203,7 @@ instance Bits Int8 where complement (I8# x) = I8# (word2Int# ((int2Word# x) `xor#` (int2Word# 0xff#))) shift (I8# x) i@(I# i#) | i > 0 = I8# (intToInt8# (iShiftL# (int8ToInt# x) i#)) - | otherwise = I8# (intToInt8# (iShiftRA# (int8ToInt# x) i#)) + | otherwise = I8# (intToInt8# (iShiftRA# (int8ToInt# x) (negateInt# i#))) i8@(I8# x) `rotate` (I# i) | i ==# 0# = i8 | i ># 0# = @@ -335,7 +335,7 @@ instance Bits Int16 where complement (I16# x) = I16# (word2Int# ((int2Word# x) `xor#` (int2Word# 0xffff#))) shift (I16# x) i@(I# i#) | i > 0 = I16# (intToInt16# (iShiftL# (int16ToInt# x) i#)) - | otherwise = I16# (intToInt16# (iShiftRA# (int16ToInt# x) i#)) + | otherwise = I16# (intToInt16# (iShiftRA# (int16ToInt# x) (negateInt# i#))) i16@(I16# x) `rotate` (I# i) | i ==# 0# = i16 | i ># 0# = @@ -484,7 +484,7 @@ instance Bits Int32 where #endif shift (I32# x) i@(I# i#) | i > 0 = I32# (intToInt32# (iShiftL# (int32ToInt# x) i#)) - | otherwise = I32# (intToInt32# (iShiftRA# (int32ToInt# x) i#)) + | otherwise = I32# (intToInt32# (iShiftRA# (int32ToInt# x) (negateInt# i#))) i32@(I32# x) `rotate` (I# i) | i ==# 0# = i32 | i ># 0# = -- 1.7.10.4