flat-0.4.4.0.0.0.0.2: Principled and efficient bit-oriented binary serialization.
Safe Haskell Safe-Inferred
Language Haskell2010

Flat.Endian

Description

Endian utilities Exported for testing purposes, but not meant to be used outside this package.

Synopsis

Documentation

toBE32 :: Word32 -> Word32 Source #

Convert a 32 bit value in cpu endianess to big endian

>>> toBE32 0xF0F1F2F3 == if isBigEndian then 0xF0F1F2F3 else 0xF3F2F1F0
True

toBE64 :: Word64 -> Word64 Source #

Convert a 64 bit value in cpu endianess to big endian

>>> toBE64 0xF0F1F2F3F4F5F6F7 == if isBigEndian then 0xF0F1F2F3F4F5F6F7 else 0xF7F6F5F4F3F2F1F0
True

toBE16 :: Word16 -> Word16 Source #

Convert a 16 bit value in cpu endianess to big endian

>>> toBE16 0xF0F1 == if isBigEndian then 0xF0F1 else 0xF1F0
True