License | BSD-style |
---|---|
Maintainer | Vincent Hanquez <vincent@snarc.org> |
Stability | stable |
Portability | good |
Safe Haskell | None |
Language | Haskell2010 |
Data.Memory.Endian
Description
Documentation
data Endianness #
represent the CPU endianness
Big endian system stores bytes with the MSB as the first byte. Little endian system stores bytes with the LSB as the first byte.
middle endian is purposely avoided.
Constructors
LittleEndian | |
BigEndian |
Instances
Eq Endianness # | |
Defined in Data.Memory.Endian | |
Show Endianness # | |
Defined in Data.Memory.Endian Methods showsPrec :: Int -> Endianness -> ShowS show :: Endianness -> String showList :: [Endianness] -> ShowS |
getSystemEndianness :: Endianness #
Return the system endianness
Big Endian value
Instances
Eq a => Eq (BE a) # | |
Show a => Show (BE a) # | |
Storable a => Storable (BE a) # | |
Defined in Data.Memory.Endian Methods peekElemOff :: Ptr (BE a) -> Int -> IO (BE a) pokeElemOff :: Ptr (BE a) -> Int -> BE a -> IO () peekByteOff :: Ptr b -> Int -> IO (BE a) pokeByteOff :: Ptr b -> Int -> BE a -> IO () |
Little Endian value
Instances
Eq a => Eq (LE a) # | |
Show a => Show (LE a) # | |
Storable a => Storable (LE a) # | |
Defined in Data.Memory.Endian Methods peekElemOff :: Ptr (LE a) -> Int -> IO (LE a) pokeElemOff :: Ptr (LE a) -> Int -> LE a -> IO () peekByteOff :: Ptr b -> Int -> IO (LE a) pokeByteOff :: Ptr b -> Int -> LE a -> IO () |
class Storable a => ByteSwap a #
Class of types that can be byte-swapped.
e.g. Word16, Word32, Word64
Minimal complete definition
byteSwap
Instances
ByteSwap Word16 # | |
Defined in Data.Memory.Endian Methods byteSwap :: Word16 -> Word16 | |
ByteSwap Word32 # | |
Defined in Data.Memory.Endian Methods byteSwap :: Word32 -> Word32 | |
ByteSwap Word64 # | |
Defined in Data.Memory.Endian Methods byteSwap :: Word64 -> Word64 |