From 0800dbf6b383dfd83a734ee6b2727002ad9a20d5 Mon Sep 17 00:00:00 2001 From: simonm <unknown> Date: Mon, 22 Feb 1999 11:47:17 +0000 Subject: [PATCH] [project @ 1999-02-22 11:47:17 by simonm] Couple of Integer fixes. --- ghc/lib/exts/Word.lhs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ghc/lib/exts/Word.lhs b/ghc/lib/exts/Word.lhs index 13079adff39f..ccc9fa1f9b95 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 -- GitLab