From 415a9993025ccdcaea100510c214f11726d0d7c0 Mon Sep 17 00:00:00 2001 From: panne <unknown> Date: Tue, 25 Jan 2000 10:06:32 +0000 Subject: [PATCH] [project @ 2000-01-25 10:06:31 by panne] Added intToWord to PrelAddr. Use it instead of int2Word#-hacks. --- ghc/lib/std/Directory.lhs | 7 +++---- ghc/lib/std/PrelAddr.lhs | 4 ++++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ghc/lib/std/Directory.lhs b/ghc/lib/std/Directory.lhs index 6ca00295fd4f..ab9010e2682d 100644 --- a/ghc/lib/std/Directory.lhs +++ b/ghc/lib/std/Directory.lhs @@ -56,7 +56,7 @@ module Directory import Prelude -- Just to get it in the dependencies -import PrelGHC ( RealWorld, int2Word#, or#, and# ) +import PrelGHC ( RealWorld, or#, and# ) import PrelByteArr ( ByteArray, MutableByteArray, newWordArray, readWordArray, newCharArray, unsafeFreezeByteArray @@ -66,7 +66,7 @@ import PrelIOBase ( stToIO, constructErrorAndFail, constructErrorAndFailWithInfo, IOError(IOError), IOErrorType(SystemError) ) import Time ( ClockTime(..) ) -import PrelAddr ( Addr, nullAddr, Word(..), wordToInt ) +import PrelAddr ( Addr, nullAddr, Word(..), wordToInt, intToWord ) #endif \end{code} @@ -545,8 +545,7 @@ emptyFileMode = primIntToWord 0 unionFileMode = primOrWord intersectFileMode = primAndWord #else ---ToDo: tidy up. -emptyFileMode = W# (int2Word# 0#) +emptyFileMode = intToWord 0 unionFileMode = orWord intersectFileMode = andWord #endif diff --git a/ghc/lib/std/PrelAddr.lhs b/ghc/lib/std/PrelAddr.lhs index 1f61cec4ad0e..3b9f77d95d5b 100644 --- a/ghc/lib/std/PrelAddr.lhs +++ b/ghc/lib/std/PrelAddr.lhs @@ -15,6 +15,7 @@ module PrelAddr ( , Word(..) , wordToInt + , intToWord , Word64(..) , Int64(..) @@ -43,6 +44,9 @@ instance CReturnable Word wordToInt :: Word -> Int wordToInt (W# w#) = I# (word2Int# w#) +intToWord :: Int -> Word +intToWord (I# i#) = W# (int2Word# i#) + #if WORD_SIZE_IN_BYTES == 8 data Word64 = W64# Word# data Int64 = I64# Int# -- GitLab