primitive-0.3.1: Wrappers for primitive operations

Portabilitynon-portable
MaintainerRoman Leshchinskiy <rl@cse.unsw.edu.au>

Data.Primitive.Addr

Description

Primitive operations on machine addresses

Synopsis

Documentation

data Addr Source

A machine address

Constructors

Addr Addr# 

nullAddr :: AddrSource

The null address

plusAddr :: Addr -> Int -> AddrSource

Offset an address by the given number of bytes

minusAddr :: Addr -> Addr -> IntSource

Distance in bytes between two addresses. The result is only valid if the difference fits in an Int.

indexOffAddr :: Prim a => Addr -> Int -> aSource

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 aSource

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.