memory-0.11: memory and related abstraction stuff

LicenseBSD-style
MaintainerVincent Hanquez <vincent@snarc.org>
Stabilitystable
Portabilitygood
Safe HaskellNone
LanguageHaskell2010

Data.Memory.Endian

Description

 

Synopsis

Documentation

data Endianness Source

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 

getSystemEndianness :: Endianness Source

Return the system endianness

newtype BE a Source

Big Endian value

Constructors

BE 

Fields

unBE :: a
 

Instances

Eq a => Eq (BE a) Source 
Show a => Show (BE a) Source 
Storable a => Storable (BE a) Source 

newtype LE a Source

Little Endian value

Constructors

LE 

Fields

unLE :: a
 

Instances

Eq a => Eq (LE a) Source 
Show a => Show (LE a) Source 
Storable a => Storable (LE a) Source 

fromBE :: ByteSwap a => BE a -> a Source

Convert from a big endian value to the cpu endianness

toBE :: ByteSwap a => a -> BE a Source

Convert a value in cpu endianess to big endian

fromLE :: ByteSwap a => LE a -> a Source

Convert from a little endian value to the cpu endianness

toLE :: ByteSwap a => a -> LE a Source

Convert a value in cpu endianess to little endian

class Storable a => ByteSwap a Source

Class of types that can be byte-swapped.

e.g. Word16, Word32, Word64

Minimal complete definition

byteSwap