memory-0.7: memory and related abtraction stuff

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

Data.Memory.Endian

Description

 

Synopsis

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 

getSystemEndianness :: Endianness

Return the system endianness

newtype BE a

Big Endian value

Constructors

BE 

Fields

unBE :: a
 

Instances

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

newtype LE a

Little Endian value

Constructors

LE 

Fields

unLE :: a
 

Instances

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

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

Convert from a big endian value to the cpu endianness

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

Convert a value in cpu endianess to big endian

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

Convert from a little endian value to the cpu endianness

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

Convert a value in cpu endianess to little endian

class Storable a => ByteSwap a

Class of types that can be byte-swapped.

e.g. Word16, Word32, Word64

Minimal complete definition

byteSwap