Commit 58545fde authored by Ben Gamari's avatar Ben Gamari Committed by Ben Gamari
Browse files

base: Introduce GHC.ByteOrder

This provides a ByteOrder type as well as a targetByteOrder value, which
indicates the byte ordering used by the target machine. We might also
consider exposing this via Data.Bits if the CLC is so inclined.

Test Plan: Needs test

Reviewers: hvr, RyanGlScott, austin

Reviewed By: hvr, RyanGlScott

Subscribers: rwbarton, thomie

Differential Revision: https://phabricator.haskell.org/D3786
parent 2183ac16
{-# LANGUAGE CPP #-}
-----------------------------------------------------------------------------
-- |
-- Module : GHC.ByteOrder
-- Copyright : (c) The University of Glasgow, 1994-2000
-- License : see libraries/base/LICENSE
--
-- Maintainer : cvs-ghc@haskell.org
-- Stability : internal
-- Portability : non-portable (GHC extensions)
--
-- Target byte ordering.
--
-----------------------------------------------------------------------------
module GHC.ByteOrder where
-- | Byte ordering.
data ByteOrder
= BigEndian -- ^ most-significant-byte occurs in lowest address.
| LittleEndian -- ^ least-significant-byte occurs in lowest address.
deriving (Eq, Ord, Bounded, Enum, Read, Show)
-- | The byte ordering of the target machine.
targetByteOrder :: ByteOrder
#if defined(WORDS_BIGENDIAN)
targetByteOrder = BigEndian
#else
targetByteOrder = LittleEndian
#endif
......@@ -202,6 +202,7 @@ Library
Foreign.Storable
GHC.Arr
GHC.Base
GHC.ByteOrder
GHC.Char
GHC.Conc
GHC.Conc.IO
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment