Go to the first, previous, next, last section, table of contents.

Words and addresses

A `Word#' is used for bit-twiddling operations. It is the same size as an `Int#', but has no sign nor any arithmetic operations.
type Word#      -- Same size/etc as Int# but *unsigned*
type Addr#      -- A pointer from outside the "Haskell world" (from C, probably);
                -- described under "arrays"
`Word#'s and `Addr#'s have the usual comparison operations. Other unboxed-`Word' ops (bit-twiddling and coercions):
and#, or#, xor# :: Word# -> Word# -> Word#
        -- standard bit ops.

quotWord#, remWord# :: Word# -> Word# -> Word#
        -- word (i.e. unsigned) versions are different from int
        -- versions, so we have to provide these explicitly.

not# :: Word# -> Word#

shiftL#, shiftRA#, shiftRL# :: Word# -> Int# -> Word#
        -- shift left, right arithmetic, right logical

int2Word#       :: Int#  -> Word# -- just a cast, really
word2Int#       :: Word# -> Int#
Unboxed-`Addr' ops (C casts, really):
int2Addr#       :: Int#  -> Addr#
addr2Int#       :: Addr# -> Int#
The casts between `Int#', `Word#' and `Addr#' correspond to null operations at the machine level, but are required to keep the Haskell type checker happy. Operations for indexing off of C pointers (`Addr#'s) to snatch values are listed under "arrays".
Go to the first, previous, next, last section, table of contents.