cpu-0.1.0: Cpu information and properties helpers.

Portabilityunknown
Stabilityexperimental
MaintainerVincent Hanquez <vincent@snarc.org>
Safe HaskellSafe-Infered

System.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 :: EndiannessSource

return the system endianness

fromLE32 :: Word32 -> Word32Source

Convert from a little endian 32 bit value to the cpu endianness

fromLE64 :: Word64 -> Word64Source

Convert from a little endian 64 bit value to the cpu endianness

toLE32 :: Word32 -> Word32Source

Convert a 32 bit value in cpu endianess to little endian

toLE64 :: Word64 -> Word64Source

Convert a 64 bit value in cpu endianess to little endian

fromBE32 :: Word32 -> Word32Source

Convert from a big endian 32 bit value to the cpu endianness

fromBE64 :: Word64 -> Word64Source

Convert from a big endian 64 bit value to the cpu endianness

toBE32 :: Word32 -> Word32Source

Convert a 32 bit value in cpu endianess to big endian

toBE64 :: Word64 -> Word64Source

Convert a 64 bit value in cpu endianess to big endian