-- plus Eq, Ord, Num, Bounded, Real, Integral, Ix, Enum, Read,
-- Show and Bits instances for each of Int8, Int16, Int32 and Int64
- -- The "official" place to get these from is Addr.
+ -- The "official" place to get these from is Addr, importing
+ -- them from Int is a non-standard thing to do.
, indexInt8OffAddr
, indexInt16OffAddr
, indexInt32OffAddr
, sizeofInt16
, sizeofInt32
, sizeofInt64
+
+ -- non-standard, GHC specific
+ , intToWord
) where
int16ToInt32 (I16# x) = I32# x
int32ToInt8 (I32# x) = I8# x
int32ToInt16 (I32# x) = I16# x
+
+--GHC specific
+intToWord :: Int -> Word
+intToWord (I# i#) = W# (int2Word# i#)
\end{code}
\subsection[Int8]{The @Int8@ interface}
, sizeofWord32
, sizeofWord64
+ -- non-standard, GHC specific
+ , wordToInt
+
) where
import GlaExts
--intToWord32 (I# x) = W32# (int2Word# x)
word32ToInt (W32# x) = I# (word2Int# x)
+wordToInt :: Word -> Int
+wordToInt (W# w#) = I# (word2Int# w#)
+
\end{code}
\subsection[Word8]{The @Word8@ interface}