cpu-0.1.2: Cpu information and properties helpers.

License | BSD-style
Maintainer | Vincent Hanquez <vincent@snarc.org>
Stability | experimental
Portability | unknown
Safe Haskell | Safe-Inferred
Language | Haskell98

System.Endian

Description

Synopsis

- data Endianness
  - = LittleEndian
  - | BigEndian
- getSystemEndianness :: Endianness
- fromLE32 :: Word32 -> Word32
- fromLE64 :: Word64 -> Word64
- fromLE16 :: Word16 -> Word16
- toLE32 :: Word32 -> Word32
- toLE64 :: Word64 -> Word64
- toLE16 :: Word16 -> Word16
- fromBE32 :: Word32 -> Word32
- fromBE64 :: Word64 -> Word64
- fromBE16 :: Word16 -> Word16
- toBE32 :: Word32 -> Word32
- toBE64 :: Word64 -> Word64
- toBE16 :: Word16 -> Word16

# 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 |

#### Instances

Instances details

Show Endianness Source # |
Instance details Defined in System.Endian Methods showsPrec :: Int -> Endianness -> ShowS Source # show :: Endianness -> String Source # showList :: [Endianness] -> ShowS Source #
Eq Endianness Source # |
Instance details Defined in System.Endian Methods (==) :: Endianness -> Endianness -> Bool Source # (/=) :: Endianness -> Endianness -> Bool Source #

getSystemEndianness :: Endianness Source #

return the system endianness

fromLE32 :: Word32 -> Word32 Source #

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

fromLE64 :: Word64 -> Word64 Source #

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

fromLE16 :: Word16 -> Word16 Source #

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

toLE32 :: Word32 -> Word32 Source #

Convert a 32 bit value in cpu endianess to little endian

toLE64 :: Word64 -> Word64 Source #

Convert a 64 bit value in cpu endianess to little endian

toLE16 :: Word16 -> Word16 Source #

Convert a 16 bit value in cpu endianness to little endian

fromBE32 :: Word32 -> Word32 Source #

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

fromBE64 :: Word64 -> Word64 Source #

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

fromBE16 :: Word16 -> Word16 Source #

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

toBE32 :: Word32 -> Word32 Source #

Convert a 32 bit value in cpu endianess to big endian

toBE64 :: Word64 -> Word64 Source #

Convert a 64 bit value in cpu endianess to big endian

toBE16 :: Word16 -> Word16 Source #

Convert a 16 bit value in cpu endianness to big endian