Copyright | (c) Roman Leshchinskiy 2009-2012 |
---|---|
License | BSD-style |
Maintainer | Roman Leshchinskiy <rl@cse.unsw.edu.au> |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Primitive operations on machine addresses
- data Addr = Addr Addr#
- nullAddr :: Addr
- plusAddr :: Addr -> Int -> Addr
- minusAddr :: Addr -> Addr -> Int
- remAddr :: Addr -> Int -> Int
- indexOffAddr :: Prim a => Addr -> Int -> a
- readOffAddr :: (Prim a, PrimMonad m) => Addr -> Int -> m a
- writeOffAddr :: (Prim a, PrimMonad m) => Addr -> Int -> a -> m ()
- copyAddr :: PrimMonad m => Addr -> Addr -> Int -> m ()
- moveAddr :: PrimMonad m => Addr -> Addr -> Int -> m ()
- setAddr :: (Prim a, PrimMonad m) => Addr -> Int -> a -> m ()
Types
A machine address
Address arithmetic
minusAddr :: Addr -> Addr -> Int infixl 6 Source #
Distance in bytes between two addresses. The result is only valid if the
difference fits in an Int
.
Element access
indexOffAddr :: Prim a => Addr -> Int -> a Source #
Read a value from a memory position given by an address and an offset.
The memory block the address refers to must be immutable. The offset is in
elements of type a
rather than in bytes.
readOffAddr :: (Prim a, PrimMonad m) => Addr -> Int -> m a Source #
Read a value from a memory position given by an address and an offset.
The offset is in elements of type a
rather than in bytes.
writeOffAddr :: (Prim a, PrimMonad m) => Addr -> Int -> a -> m () Source #
Write a value to a memory position given by an address and an offset.
The offset is in elements of type a
rather than in bytes.
Block operations
Copy the given number of bytes from the second Addr
to the first. The
areas may not overlap.
Copy the given number of bytes from the second Addr
to the first. The
areas may overlap.