Commit 415a9993 authored by panne's avatar panne
Browse files

[project @ 2000-01-25 10:06:31 by panne]

Added intToWord to PrelAddr.
Use it instead of int2Word#-hacks.
parent 3ba6150e
...@@ -56,7 +56,7 @@ module Directory ...@@ -56,7 +56,7 @@ module Directory
import Prelude -- Just to get it in the dependencies import Prelude -- Just to get it in the dependencies
import PrelGHC ( RealWorld, int2Word#, or#, and# ) import PrelGHC ( RealWorld, or#, and# )
import PrelByteArr ( ByteArray, MutableByteArray, import PrelByteArr ( ByteArray, MutableByteArray,
newWordArray, readWordArray, newCharArray, newWordArray, readWordArray, newCharArray,
unsafeFreezeByteArray unsafeFreezeByteArray
...@@ -66,7 +66,7 @@ import PrelIOBase ( stToIO, ...@@ -66,7 +66,7 @@ import PrelIOBase ( stToIO,
constructErrorAndFail, constructErrorAndFailWithInfo, constructErrorAndFail, constructErrorAndFailWithInfo,
IOError(IOError), IOErrorType(SystemError) ) IOError(IOError), IOErrorType(SystemError) )
import Time ( ClockTime(..) ) import Time ( ClockTime(..) )
import PrelAddr ( Addr, nullAddr, Word(..), wordToInt ) import PrelAddr ( Addr, nullAddr, Word(..), wordToInt, intToWord )
#endif #endif
\end{code} \end{code}
...@@ -545,8 +545,7 @@ emptyFileMode = primIntToWord 0 ...@@ -545,8 +545,7 @@ emptyFileMode = primIntToWord 0
unionFileMode = primOrWord unionFileMode = primOrWord
intersectFileMode = primAndWord intersectFileMode = primAndWord
#else #else
--ToDo: tidy up. emptyFileMode = intToWord 0
emptyFileMode = W# (int2Word# 0#)
unionFileMode = orWord unionFileMode = orWord
intersectFileMode = andWord intersectFileMode = andWord
#endif #endif
......
...@@ -15,6 +15,7 @@ module PrelAddr ( ...@@ -15,6 +15,7 @@ module PrelAddr (
, Word(..) , Word(..)
, wordToInt , wordToInt
, intToWord
, Word64(..) , Word64(..)
, Int64(..) , Int64(..)
...@@ -43,6 +44,9 @@ instance CReturnable Word ...@@ -43,6 +44,9 @@ instance CReturnable Word
wordToInt :: Word -> Int wordToInt :: Word -> Int
wordToInt (W# w#) = I# (word2Int# w#) wordToInt (W# w#) = I# (word2Int# w#)
intToWord :: Int -> Word
intToWord (I# i#) = W# (int2Word# i#)
#if WORD_SIZE_IN_BYTES == 8 #if WORD_SIZE_IN_BYTES == 8
data Word64 = W64# Word# data Word64 = W64# Word#
data Int64 = I64# Int# data Int64 = I64# Int#
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment