- In addition, GHC supports families of explicit-sized integers and words at
- 8, 16, 32, and 64 bits, with the usual arithmetic operations, comparisons,
- and a range of conversions. The 8-bit and 16-bit sizes are always represented as
- {\tt Int\#} and {\tt Word\#}, and the operations implemented in terms of the
- the primops on these types, with suitable range restrictions on the results
- (using the {\tt narrow$n$Int\#} and {\tt narrow$n$Word\#} families of primops.
- The 32-bit sizes are represented using {\tt Int\#} and {\tt Word\#} when
- {\tt WORD\_SIZE\_IN\_BITS} $\geq$ 32;
- otherwise, these are represented using distinct primitive types {\tt Int32\#}
- and {\tt Word32\#}. These (when needed) have a complete set of corresponding
- operations; however, nearly all of these are implemented as external C functions
- rather than as primops. Exactly the same story applies to the 64-bit sizes.
- All of these details are hidden under the {\tt PrelInt} and {\tt PrelWord} modules,
- which use {\tt \#if}-defs to invoke the appropriate types and operators.
-
- Word size also matters for the families of primops
- for indexing/reading/writing fixed-size quantities at offsets from
- an array base, address, or foreign pointer. Here, a slightly different approach is taken.
- The names of these primops are fixed, but their
- {\it types} vary according to the value of {\tt WORD\_SIZE\_IN\_BITS}. For example, if
- word size is at least 32 bits then an operator like \texttt{indexInt32Array\#}
- has type {\tt ByteArr\# -> Int\# -> Int\#}; otherwise it has type
- {\tt ByteArr\# -> Int\# -> Int32\#}. This approach confines the necessary {\tt \#if}-defs to this file;
- no conditional compilation is needed in the files that expose these primops, namely \texttt{lib/std/PrelStorable.lhs},
- \texttt{hslibs/lang/ArrayBase.hs}, and (in deprecated fashion) in \texttt{hslibs/lang/ForeignObj.lhs}
- and \texttt{hslibs/lang/Addr.lhs}.
-
- Finally, there are strongly deprecated primops for coercing between {\tt Addr\#}, the primitive
- type of machine addresses, and {\tt Int\#}. These are pretty bogus anyway, but will work on
- existing 32-bit and 64-bit GHC targets; they are completely bogus when tag bits are used in
- {\tt Int\#}, so are not available in this case.
-}
+ In addition, GHC supports families of explicit-sized integers
+ and words at 8, 16, 32, and 64 bits, with the usual
+ arithmetic operations, comparisons, and a range of
+ conversions. The 8-bit and 16-bit sizes are always
+ represented as {\tt Int\#} and {\tt Word\#}, and the
+ operations implemented in terms of the the primops on these
+ types, with suitable range restrictions on the results (using
+ the {\tt narrow$n$Int\#} and {\tt narrow$n$Word\#} families
+ of primops. The 32-bit sizes are represented using {\tt
+ Int\#} and {\tt Word\#} when {\tt WORD\_SIZE\_IN\_BITS}
+ $\geq$ 32; otherwise, these are represented using distinct
+ primitive types {\tt Int32\#} and {\tt Word32\#}. These (when
+ needed) have a complete set of corresponding operations;
+ however, nearly all of these are implemented as external C
+ functions rather than as primops. Exactly the same story
+ applies to the 64-bit sizes. All of these details are hidden
+ under the {\tt PrelInt} and {\tt PrelWord} modules, which use
+ {\tt \#if}-defs to invoke the appropriate types and
+ operators.
+
+ Word size also matters for the families of primops for
+ indexing/reading/writing fixed-size quantities at offsets
+ from an array base, address, or foreign pointer. Here, a
+ slightly different approach is taken. The names of these
+ primops are fixed, but their {\it types} vary according to
+ the value of {\tt WORD\_SIZE\_IN\_BITS}. For example, if word
+ size is at least 32 bits then an operator like
+ \texttt{indexInt32Array\#} has type {\tt ByteArr\# -> Int\#
+ -> Int\#}; otherwise it has type {\tt ByteArr\# -> Int\# ->
+ Int32\#}. This approach confines the necessary {\tt
+ \#if}-defs to this file; no conditional compilation is needed
+ in the files that expose these primops, namely
+ \texttt{lib/std/PrelStorable.lhs},
+ \texttt{hslibs/lang/ArrayBase.hs}, and (in deprecated
+ fashion) in \texttt{hslibs/lang/ForeignObj.lhs} and
+ \texttt{hslibs/lang/Addr.lhs}.
+
+ Finally, there are strongly deprecated primops for coercing
+ between {\tt Addr\#}, the primitive type of machine
+ addresses, and {\tt Int\#}. These are pretty bogus anyway,
+ but will work on existing 32-bit and 64-bit GHC targets; they
+ are completely bogus when tag bits are used in {\tt Int\#},
+ so are not available in this case. }