From: simonm Date: Mon, 22 Feb 1999 11:47:17 +0000 (+0000) Subject: [project @ 1999-02-22 11:47:17 by simonm] X-Git-Tag: Approximately_9120_patches~6522 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=0800dbf6b383dfd83a734ee6b2727002ad9a20d5;p=ghc-hetmet.git [project @ 1999-02-22 11:47:17 by simonm] Couple of Integer fixes. --- diff --git a/ghc/lib/exts/Word.lhs b/ghc/lib/exts/Word.lhs index 13079ad..ccc9fa1 100644 --- a/ghc/lib/exts/Word.lhs +++ b/ghc/lib/exts/Word.lhs @@ -233,6 +233,7 @@ instance Num Word8 where x' = word2Int# x abs x = x signum = signumReal + fromInteger (S# i#) = W8# (wordToWord8# (int2Word# i#)) fromInteger (J# s# d#) = W8# (wordToWord8# (integer2Word# s# d#)) fromInt = intToWord8 @@ -413,6 +414,7 @@ instance Num Word16 where x' = word2Int# x abs x = x signum = signumReal + fromInteger (S# i#) = W16# (wordToWord16# (int2Word# i#)) fromInteger (J# s# d#) = W16# (wordToWord16# (integer2Word# s# d#)) fromInt = intToWord16 @@ -570,7 +572,8 @@ instance Num Word32 where #endif abs x = x signum = signumReal - fromInteger (J# s# d#) = W32# (integer2Word# s# d#) + fromInteger (S# i#) = W32# (intToWord32# i#) + fromInteger (J# s# d#) = W32# (wordToWord32# (integer2Word# s# d#)) fromInt (I# x) = W32# (intToWord32# x) -- ToDo: restrict fromInt{eger} range. @@ -801,6 +804,7 @@ instance Num Word64 where x' = word2Int# x abs x = x signum = signumReal + fromInteger (S# i#) = W64# (int2Word# i#) fromInteger (J# s# d#) = W64# (integer2Word# s# d#) fromInt = intToWord64