{-|
Description: A common location for defining multi-byte value ordering.
Copyright        : (c) Galois, Inc 2019
-}

module Data.Parameterized.Utils.Endian where

-- | Determines the composition of smaller numeric values into larger values.
--
--  BigEndian = most significant values in the lowest index location / first
--  LittleEndian = least significant values in the lowest index location / first
--
--  Value: 0x01020304
--  BigEndian    = [ 0x01, 0x02, 0x03, 0x04 ]
--  LittleEndian = [ 0x04, 0x03, 0x02, 0x01 ]
data Endian = LittleEndian | BigEndian deriving (Endian -> Endian -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Endian -> Endian -> Bool
$c/= :: Endian -> Endian -> Bool
== :: Endian -> Endian -> Bool
$c== :: Endian -> Endian -> Bool
Eq,Int -> Endian -> ShowS
[Endian] -> ShowS
Endian -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Endian] -> ShowS
$cshowList :: [Endian] -> ShowS
show :: Endian -> String
$cshow :: Endian -> String
showsPrec :: Int -> Endian -> ShowS
$cshowsPrec :: Int -> Endian -> ShowS
Show,Eq Endian
Endian -> Endian -> Bool
Endian -> Endian -> Ordering
Endian -> Endian -> Endian
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Endian -> Endian -> Endian
$cmin :: Endian -> Endian -> Endian
max :: Endian -> Endian -> Endian
$cmax :: Endian -> Endian -> Endian
>= :: Endian -> Endian -> Bool
$c>= :: Endian -> Endian -> Bool
> :: Endian -> Endian -> Bool
$c> :: Endian -> Endian -> Bool
<= :: Endian -> Endian -> Bool
$c<= :: Endian -> Endian -> Bool
< :: Endian -> Endian -> Bool
$c< :: Endian -> Endian -> Bool
compare :: Endian -> Endian -> Ordering
$ccompare :: Endian -> Endian -> Ordering
Ord)