Skip to content
Snippets Groups Projects
Commit ef6dd2be authored by sof's avatar sof
Browse files

[project @ 1998-07-08 10:00:17 by sof]

Int <-> Addr (non-std) conversions
parent 5f297733
No related merge requests found
......@@ -10,6 +10,10 @@ module Addr
, module Word
, module Int
, module Addr
-- (non-standard) coercions
, addrToInt -- :: Addr -> Int
, intToAddr -- :: Int -> Addr
) where
......@@ -34,6 +38,16 @@ import Int ( indexInt8OffAddr, indexInt16OffAddr
\end{code}
Coercing between machine ints and words
\begin{code}
addrToInt :: Addr -> Int
addrToInt (A# a#) = I# (addr2Int# a#)
intToAddr :: Int -> Addr
intToAddr (I# i#) = A# (int2Addr# i#)
\end{code}
Indexing immutable memory:
\begin{code}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment