{-# LANGUAGE DeriveGeneric, GeneralizedNewtypeDeriving #-}
module Data.Storable.Endian
(
LittleEndian(..), BigEndian(..),
HasLittleEndian(..), HasBigEndian(..)
)
where
import System.ByteOrder
import Foreign.Ptr
import Foreign.Storable
import Unsafe.Coerce
import Data.Bits
import Data.Word
import Data.Int
import GHC.Generics (Generic(..))
newtype LittleEndian a = LE { LittleEndian a -> a
getLittleEndian :: a }
deriving ( LittleEndian a -> LittleEndian a -> Bool
(LittleEndian a -> LittleEndian a -> Bool)
-> (LittleEndian a -> LittleEndian a -> Bool)
-> Eq (LittleEndian a)
forall a. Eq a => LittleEndian a -> LittleEndian a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LittleEndian a -> LittleEndian a -> Bool
$c/= :: forall a. Eq a => LittleEndian a -> LittleEndian a -> Bool
== :: LittleEndian a -> LittleEndian a -> Bool
$c== :: forall a. Eq a => LittleEndian a -> LittleEndian a -> Bool
Eq, Eq (LittleEndian a)
Eq (LittleEndian a)
-> (LittleEndian a -> LittleEndian a -> Ordering)
-> (LittleEndian a -> LittleEndian a -> Bool)
-> (LittleEndian a -> LittleEndian a -> Bool)
-> (LittleEndian a -> LittleEndian a -> Bool)
-> (LittleEndian a -> LittleEndian a -> Bool)
-> (LittleEndian a -> LittleEndian a -> LittleEndian a)
-> (LittleEndian a -> LittleEndian a -> LittleEndian a)
-> Ord (LittleEndian a)
LittleEndian a -> LittleEndian a -> Bool
LittleEndian a -> LittleEndian a -> Ordering
LittleEndian a -> LittleEndian a -> LittleEndian a
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
forall a. Ord a => Eq (LittleEndian a)
forall a. Ord a => LittleEndian a -> LittleEndian a -> Bool
forall a. Ord a => LittleEndian a -> LittleEndian a -> Ordering
forall a.
Ord a =>
LittleEndian a -> LittleEndian a -> LittleEndian a
min :: LittleEndian a -> LittleEndian a -> LittleEndian a
$cmin :: forall a.
Ord a =>
LittleEndian a -> LittleEndian a -> LittleEndian a
max :: LittleEndian a -> LittleEndian a -> LittleEndian a
$cmax :: forall a.
Ord a =>
LittleEndian a -> LittleEndian a -> LittleEndian a
>= :: LittleEndian a -> LittleEndian a -> Bool
$c>= :: forall a. Ord a => LittleEndian a -> LittleEndian a -> Bool
> :: LittleEndian a -> LittleEndian a -> Bool
$c> :: forall a. Ord a => LittleEndian a -> LittleEndian a -> Bool
<= :: LittleEndian a -> LittleEndian a -> Bool
$c<= :: forall a. Ord a => LittleEndian a -> LittleEndian a -> Bool
< :: LittleEndian a -> LittleEndian a -> Bool
$c< :: forall a. Ord a => LittleEndian a -> LittleEndian a -> Bool
compare :: LittleEndian a -> LittleEndian a -> Ordering
$ccompare :: forall a. Ord a => LittleEndian a -> LittleEndian a -> Ordering
$cp1Ord :: forall a. Ord a => Eq (LittleEndian a)
Ord, Int -> LittleEndian a -> ShowS
[LittleEndian a] -> ShowS
LittleEndian a -> String
(Int -> LittleEndian a -> ShowS)
-> (LittleEndian a -> String)
-> ([LittleEndian a] -> ShowS)
-> Show (LittleEndian a)
forall a. Show a => Int -> LittleEndian a -> ShowS
forall a. Show a => [LittleEndian a] -> ShowS
forall a. Show a => LittleEndian a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LittleEndian a] -> ShowS
$cshowList :: forall a. Show a => [LittleEndian a] -> ShowS
show :: LittleEndian a -> String
$cshow :: forall a. Show a => LittleEndian a -> String
showsPrec :: Int -> LittleEndian a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> LittleEndian a -> ShowS
Show, ReadPrec [LittleEndian a]
ReadPrec (LittleEndian a)
Int -> ReadS (LittleEndian a)
ReadS [LittleEndian a]
(Int -> ReadS (LittleEndian a))
-> ReadS [LittleEndian a]
-> ReadPrec (LittleEndian a)
-> ReadPrec [LittleEndian a]
-> Read (LittleEndian a)
forall a. Read a => ReadPrec [LittleEndian a]
forall a. Read a => ReadPrec (LittleEndian a)
forall a. Read a => Int -> ReadS (LittleEndian a)
forall a. Read a => ReadS [LittleEndian a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LittleEndian a]
$creadListPrec :: forall a. Read a => ReadPrec [LittleEndian a]
readPrec :: ReadPrec (LittleEndian a)
$creadPrec :: forall a. Read a => ReadPrec (LittleEndian a)
readList :: ReadS [LittleEndian a]
$creadList :: forall a. Read a => ReadS [LittleEndian a]
readsPrec :: Int -> ReadS (LittleEndian a)
$creadsPrec :: forall a. Read a => Int -> ReadS (LittleEndian a)
Read, Int -> LittleEndian a
LittleEndian a -> Int
LittleEndian a -> [LittleEndian a]
LittleEndian a -> LittleEndian a
LittleEndian a -> LittleEndian a -> [LittleEndian a]
LittleEndian a
-> LittleEndian a -> LittleEndian a -> [LittleEndian a]
(LittleEndian a -> LittleEndian a)
-> (LittleEndian a -> LittleEndian a)
-> (Int -> LittleEndian a)
-> (LittleEndian a -> Int)
-> (LittleEndian a -> [LittleEndian a])
-> (LittleEndian a -> LittleEndian a -> [LittleEndian a])
-> (LittleEndian a -> LittleEndian a -> [LittleEndian a])
-> (LittleEndian a
-> LittleEndian a -> LittleEndian a -> [LittleEndian a])
-> Enum (LittleEndian a)
forall a. Enum a => Int -> LittleEndian a
forall a. Enum a => LittleEndian a -> Int
forall a. Enum a => LittleEndian a -> [LittleEndian a]
forall a. Enum a => LittleEndian a -> LittleEndian a
forall a.
Enum a =>
LittleEndian a -> LittleEndian a -> [LittleEndian a]
forall a.
Enum a =>
LittleEndian a
-> LittleEndian a -> LittleEndian a -> [LittleEndian a]
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: LittleEndian a
-> LittleEndian a -> LittleEndian a -> [LittleEndian a]
$cenumFromThenTo :: forall a.
Enum a =>
LittleEndian a
-> LittleEndian a -> LittleEndian a -> [LittleEndian a]
enumFromTo :: LittleEndian a -> LittleEndian a -> [LittleEndian a]
$cenumFromTo :: forall a.
Enum a =>
LittleEndian a -> LittleEndian a -> [LittleEndian a]
enumFromThen :: LittleEndian a -> LittleEndian a -> [LittleEndian a]
$cenumFromThen :: forall a.
Enum a =>
LittleEndian a -> LittleEndian a -> [LittleEndian a]
enumFrom :: LittleEndian a -> [LittleEndian a]
$cenumFrom :: forall a. Enum a => LittleEndian a -> [LittleEndian a]
fromEnum :: LittleEndian a -> Int
$cfromEnum :: forall a. Enum a => LittleEndian a -> Int
toEnum :: Int -> LittleEndian a
$ctoEnum :: forall a. Enum a => Int -> LittleEndian a
pred :: LittleEndian a -> LittleEndian a
$cpred :: forall a. Enum a => LittleEndian a -> LittleEndian a
succ :: LittleEndian a -> LittleEndian a
$csucc :: forall a. Enum a => LittleEndian a -> LittleEndian a
Enum
, Integer -> LittleEndian a
LittleEndian a -> LittleEndian a
LittleEndian a -> LittleEndian a -> LittleEndian a
(LittleEndian a -> LittleEndian a -> LittleEndian a)
-> (LittleEndian a -> LittleEndian a -> LittleEndian a)
-> (LittleEndian a -> LittleEndian a -> LittleEndian a)
-> (LittleEndian a -> LittleEndian a)
-> (LittleEndian a -> LittleEndian a)
-> (LittleEndian a -> LittleEndian a)
-> (Integer -> LittleEndian a)
-> Num (LittleEndian a)
forall a. Num a => Integer -> LittleEndian a
forall a. Num a => LittleEndian a -> LittleEndian a
forall a.
Num a =>
LittleEndian a -> LittleEndian a -> LittleEndian a
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
fromInteger :: Integer -> LittleEndian a
$cfromInteger :: forall a. Num a => Integer -> LittleEndian a
signum :: LittleEndian a -> LittleEndian a
$csignum :: forall a. Num a => LittleEndian a -> LittleEndian a
abs :: LittleEndian a -> LittleEndian a
$cabs :: forall a. Num a => LittleEndian a -> LittleEndian a
negate :: LittleEndian a -> LittleEndian a
$cnegate :: forall a. Num a => LittleEndian a -> LittleEndian a
* :: LittleEndian a -> LittleEndian a -> LittleEndian a
$c* :: forall a.
Num a =>
LittleEndian a -> LittleEndian a -> LittleEndian a
- :: LittleEndian a -> LittleEndian a -> LittleEndian a
$c- :: forall a.
Num a =>
LittleEndian a -> LittleEndian a -> LittleEndian a
+ :: LittleEndian a -> LittleEndian a -> LittleEndian a
$c+ :: forall a.
Num a =>
LittleEndian a -> LittleEndian a -> LittleEndian a
Num, Enum (LittleEndian a)
Real (LittleEndian a)
Real (LittleEndian a)
-> Enum (LittleEndian a)
-> (LittleEndian a -> LittleEndian a -> LittleEndian a)
-> (LittleEndian a -> LittleEndian a -> LittleEndian a)
-> (LittleEndian a -> LittleEndian a -> LittleEndian a)
-> (LittleEndian a -> LittleEndian a -> LittleEndian a)
-> (LittleEndian a
-> LittleEndian a -> (LittleEndian a, LittleEndian a))
-> (LittleEndian a
-> LittleEndian a -> (LittleEndian a, LittleEndian a))
-> (LittleEndian a -> Integer)
-> Integral (LittleEndian a)
LittleEndian a -> Integer
LittleEndian a
-> LittleEndian a -> (LittleEndian a, LittleEndian a)
LittleEndian a -> LittleEndian a -> LittleEndian a
forall a. Integral a => Enum (LittleEndian a)
forall a. Integral a => Real (LittleEndian a)
forall a. Integral a => LittleEndian a -> Integer
forall a.
Integral a =>
LittleEndian a
-> LittleEndian a -> (LittleEndian a, LittleEndian a)
forall a.
Integral a =>
LittleEndian a -> LittleEndian a -> LittleEndian a
forall a.
Real a
-> Enum a
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> (a, a))
-> (a -> a -> (a, a))
-> (a -> Integer)
-> Integral a
toInteger :: LittleEndian a -> Integer
$ctoInteger :: forall a. Integral a => LittleEndian a -> Integer
divMod :: LittleEndian a
-> LittleEndian a -> (LittleEndian a, LittleEndian a)
$cdivMod :: forall a.
Integral a =>
LittleEndian a
-> LittleEndian a -> (LittleEndian a, LittleEndian a)
quotRem :: LittleEndian a
-> LittleEndian a -> (LittleEndian a, LittleEndian a)
$cquotRem :: forall a.
Integral a =>
LittleEndian a
-> LittleEndian a -> (LittleEndian a, LittleEndian a)
mod :: LittleEndian a -> LittleEndian a -> LittleEndian a
$cmod :: forall a.
Integral a =>
LittleEndian a -> LittleEndian a -> LittleEndian a
div :: LittleEndian a -> LittleEndian a -> LittleEndian a
$cdiv :: forall a.
Integral a =>
LittleEndian a -> LittleEndian a -> LittleEndian a
rem :: LittleEndian a -> LittleEndian a -> LittleEndian a
$crem :: forall a.
Integral a =>
LittleEndian a -> LittleEndian a -> LittleEndian a
quot :: LittleEndian a -> LittleEndian a -> LittleEndian a
$cquot :: forall a.
Integral a =>
LittleEndian a -> LittleEndian a -> LittleEndian a
$cp2Integral :: forall a. Integral a => Enum (LittleEndian a)
$cp1Integral :: forall a. Integral a => Real (LittleEndian a)
Integral, Num (LittleEndian a)
Num (LittleEndian a)
-> (LittleEndian a -> LittleEndian a -> LittleEndian a)
-> (LittleEndian a -> LittleEndian a)
-> (Rational -> LittleEndian a)
-> Fractional (LittleEndian a)
Rational -> LittleEndian a
LittleEndian a -> LittleEndian a
LittleEndian a -> LittleEndian a -> LittleEndian a
forall a. Fractional a => Num (LittleEndian a)
forall a. Fractional a => Rational -> LittleEndian a
forall a. Fractional a => LittleEndian a -> LittleEndian a
forall a.
Fractional a =>
LittleEndian a -> LittleEndian a -> LittleEndian a
forall a.
Num a
-> (a -> a -> a) -> (a -> a) -> (Rational -> a) -> Fractional a
fromRational :: Rational -> LittleEndian a
$cfromRational :: forall a. Fractional a => Rational -> LittleEndian a
recip :: LittleEndian a -> LittleEndian a
$crecip :: forall a. Fractional a => LittleEndian a -> LittleEndian a
/ :: LittleEndian a -> LittleEndian a -> LittleEndian a
$c/ :: forall a.
Fractional a =>
LittleEndian a -> LittleEndian a -> LittleEndian a
$cp1Fractional :: forall a. Fractional a => Num (LittleEndian a)
Fractional, Fractional (LittleEndian a)
LittleEndian a
Fractional (LittleEndian a)
-> LittleEndian a
-> (LittleEndian a -> LittleEndian a)
-> (LittleEndian a -> LittleEndian a)
-> (LittleEndian a -> LittleEndian a)
-> (LittleEndian a -> LittleEndian a -> LittleEndian a)
-> (LittleEndian a -> LittleEndian a -> LittleEndian a)
-> (LittleEndian a -> LittleEndian a)
-> (LittleEndian a -> LittleEndian a)
-> (LittleEndian a -> LittleEndian a)
-> (LittleEndian a -> LittleEndian a)
-> (LittleEndian a -> LittleEndian a)
-> (LittleEndian a -> LittleEndian a)
-> (LittleEndian a -> LittleEndian a)
-> (LittleEndian a -> LittleEndian a)
-> (LittleEndian a -> LittleEndian a)
-> (LittleEndian a -> LittleEndian a)
-> (LittleEndian a -> LittleEndian a)
-> (LittleEndian a -> LittleEndian a)
-> (LittleEndian a -> LittleEndian a)
-> (LittleEndian a -> LittleEndian a)
-> (LittleEndian a -> LittleEndian a)
-> (LittleEndian a -> LittleEndian a)
-> Floating (LittleEndian a)
LittleEndian a -> LittleEndian a
LittleEndian a -> LittleEndian a -> LittleEndian a
forall a. Floating a => Fractional (LittleEndian a)
forall a. Floating a => LittleEndian a
forall a. Floating a => LittleEndian a -> LittleEndian a
forall a.
Floating a =>
LittleEndian a -> LittleEndian a -> LittleEndian a
forall a.
Fractional a
-> a
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> Floating a
log1mexp :: LittleEndian a -> LittleEndian a
$clog1mexp :: forall a. Floating a => LittleEndian a -> LittleEndian a
log1pexp :: LittleEndian a -> LittleEndian a
$clog1pexp :: forall a. Floating a => LittleEndian a -> LittleEndian a
expm1 :: LittleEndian a -> LittleEndian a
$cexpm1 :: forall a. Floating a => LittleEndian a -> LittleEndian a
log1p :: LittleEndian a -> LittleEndian a
$clog1p :: forall a. Floating a => LittleEndian a -> LittleEndian a
atanh :: LittleEndian a -> LittleEndian a
$catanh :: forall a. Floating a => LittleEndian a -> LittleEndian a
acosh :: LittleEndian a -> LittleEndian a
$cacosh :: forall a. Floating a => LittleEndian a -> LittleEndian a
asinh :: LittleEndian a -> LittleEndian a
$casinh :: forall a. Floating a => LittleEndian a -> LittleEndian a
tanh :: LittleEndian a -> LittleEndian a
$ctanh :: forall a. Floating a => LittleEndian a -> LittleEndian a
cosh :: LittleEndian a -> LittleEndian a
$ccosh :: forall a. Floating a => LittleEndian a -> LittleEndian a
sinh :: LittleEndian a -> LittleEndian a
$csinh :: forall a. Floating a => LittleEndian a -> LittleEndian a
atan :: LittleEndian a -> LittleEndian a
$catan :: forall a. Floating a => LittleEndian a -> LittleEndian a
acos :: LittleEndian a -> LittleEndian a
$cacos :: forall a. Floating a => LittleEndian a -> LittleEndian a
asin :: LittleEndian a -> LittleEndian a
$casin :: forall a. Floating a => LittleEndian a -> LittleEndian a
tan :: LittleEndian a -> LittleEndian a
$ctan :: forall a. Floating a => LittleEndian a -> LittleEndian a
cos :: LittleEndian a -> LittleEndian a
$ccos :: forall a. Floating a => LittleEndian a -> LittleEndian a
sin :: LittleEndian a -> LittleEndian a
$csin :: forall a. Floating a => LittleEndian a -> LittleEndian a
logBase :: LittleEndian a -> LittleEndian a -> LittleEndian a
$clogBase :: forall a.
Floating a =>
LittleEndian a -> LittleEndian a -> LittleEndian a
** :: LittleEndian a -> LittleEndian a -> LittleEndian a
$c** :: forall a.
Floating a =>
LittleEndian a -> LittleEndian a -> LittleEndian a
sqrt :: LittleEndian a -> LittleEndian a
$csqrt :: forall a. Floating a => LittleEndian a -> LittleEndian a
log :: LittleEndian a -> LittleEndian a
$clog :: forall a. Floating a => LittleEndian a -> LittleEndian a
exp :: LittleEndian a -> LittleEndian a
$cexp :: forall a. Floating a => LittleEndian a -> LittleEndian a
pi :: LittleEndian a
$cpi :: forall a. Floating a => LittleEndian a
$cp1Floating :: forall a. Floating a => Fractional (LittleEndian a)
Floating, Num (LittleEndian a)
Ord (LittleEndian a)
Num (LittleEndian a)
-> Ord (LittleEndian a)
-> (LittleEndian a -> Rational)
-> Real (LittleEndian a)
LittleEndian a -> Rational
forall a. Num a -> Ord a -> (a -> Rational) -> Real a
forall a. Real a => Num (LittleEndian a)
forall a. Real a => Ord (LittleEndian a)
forall a. Real a => LittleEndian a -> Rational
toRational :: LittleEndian a -> Rational
$ctoRational :: forall a. Real a => LittleEndian a -> Rational
$cp2Real :: forall a. Real a => Ord (LittleEndian a)
$cp1Real :: forall a. Real a => Num (LittleEndian a)
Real, Fractional (LittleEndian a)
Real (LittleEndian a)
Real (LittleEndian a)
-> Fractional (LittleEndian a)
-> (forall b. Integral b => LittleEndian a -> (b, LittleEndian a))
-> (forall b. Integral b => LittleEndian a -> b)
-> (forall b. Integral b => LittleEndian a -> b)
-> (forall b. Integral b => LittleEndian a -> b)
-> (forall b. Integral b => LittleEndian a -> b)
-> RealFrac (LittleEndian a)
LittleEndian a -> b
LittleEndian a -> b
LittleEndian a -> b
LittleEndian a -> b
LittleEndian a -> (b, LittleEndian a)
forall b. Integral b => LittleEndian a -> b
forall b. Integral b => LittleEndian a -> (b, LittleEndian a)
forall a.
Real a
-> Fractional a
-> (forall b. Integral b => a -> (b, a))
-> (forall b. Integral b => a -> b)
-> (forall b. Integral b => a -> b)
-> (forall b. Integral b => a -> b)
-> (forall b. Integral b => a -> b)
-> RealFrac a
forall a. RealFrac a => Fractional (LittleEndian a)
forall a. RealFrac a => Real (LittleEndian a)
forall a b. (RealFrac a, Integral b) => LittleEndian a -> b
forall a b.
(RealFrac a, Integral b) =>
LittleEndian a -> (b, LittleEndian a)
floor :: LittleEndian a -> b
$cfloor :: forall a b. (RealFrac a, Integral b) => LittleEndian a -> b
ceiling :: LittleEndian a -> b
$cceiling :: forall a b. (RealFrac a, Integral b) => LittleEndian a -> b
round :: LittleEndian a -> b
$cround :: forall a b. (RealFrac a, Integral b) => LittleEndian a -> b
truncate :: LittleEndian a -> b
$ctruncate :: forall a b. (RealFrac a, Integral b) => LittleEndian a -> b
properFraction :: LittleEndian a -> (b, LittleEndian a)
$cproperFraction :: forall a b.
(RealFrac a, Integral b) =>
LittleEndian a -> (b, LittleEndian a)
$cp2RealFrac :: forall a. RealFrac a => Fractional (LittleEndian a)
$cp1RealFrac :: forall a. RealFrac a => Real (LittleEndian a)
RealFrac, Floating (LittleEndian a)
RealFrac (LittleEndian a)
RealFrac (LittleEndian a)
-> Floating (LittleEndian a)
-> (LittleEndian a -> Integer)
-> (LittleEndian a -> Int)
-> (LittleEndian a -> (Int, Int))
-> (LittleEndian a -> (Integer, Int))
-> (Integer -> Int -> LittleEndian a)
-> (LittleEndian a -> Int)
-> (LittleEndian a -> LittleEndian a)
-> (Int -> LittleEndian a -> LittleEndian a)
-> (LittleEndian a -> Bool)
-> (LittleEndian a -> Bool)
-> (LittleEndian a -> Bool)
-> (LittleEndian a -> Bool)
-> (LittleEndian a -> Bool)
-> (LittleEndian a -> LittleEndian a -> LittleEndian a)
-> RealFloat (LittleEndian a)
Int -> LittleEndian a -> LittleEndian a
Integer -> Int -> LittleEndian a
LittleEndian a -> Bool
LittleEndian a -> Int
LittleEndian a -> Integer
LittleEndian a -> (Int, Int)
LittleEndian a -> (Integer, Int)
LittleEndian a -> LittleEndian a
LittleEndian a -> LittleEndian a -> LittleEndian a
forall a. RealFloat a => Floating (LittleEndian a)
forall a. RealFloat a => RealFrac (LittleEndian a)
forall a. RealFloat a => Int -> LittleEndian a -> LittleEndian a
forall a. RealFloat a => Integer -> Int -> LittleEndian a
forall a. RealFloat a => LittleEndian a -> Bool
forall a. RealFloat a => LittleEndian a -> Int
forall a. RealFloat a => LittleEndian a -> Integer
forall a. RealFloat a => LittleEndian a -> (Int, Int)
forall a. RealFloat a => LittleEndian a -> (Integer, Int)
forall a. RealFloat a => LittleEndian a -> LittleEndian a
forall a.
RealFloat a =>
LittleEndian a -> LittleEndian a -> LittleEndian a
forall a.
RealFrac a
-> Floating a
-> (a -> Integer)
-> (a -> Int)
-> (a -> (Int, Int))
-> (a -> (Integer, Int))
-> (Integer -> Int -> a)
-> (a -> Int)
-> (a -> a)
-> (Int -> a -> a)
-> (a -> Bool)
-> (a -> Bool)
-> (a -> Bool)
-> (a -> Bool)
-> (a -> Bool)
-> (a -> a -> a)
-> RealFloat a
atan2 :: LittleEndian a -> LittleEndian a -> LittleEndian a
$catan2 :: forall a.
RealFloat a =>
LittleEndian a -> LittleEndian a -> LittleEndian a
isIEEE :: LittleEndian a -> Bool
$cisIEEE :: forall a. RealFloat a => LittleEndian a -> Bool
isNegativeZero :: LittleEndian a -> Bool
$cisNegativeZero :: forall a. RealFloat a => LittleEndian a -> Bool
isDenormalized :: LittleEndian a -> Bool
$cisDenormalized :: forall a. RealFloat a => LittleEndian a -> Bool
isInfinite :: LittleEndian a -> Bool
$cisInfinite :: forall a. RealFloat a => LittleEndian a -> Bool
isNaN :: LittleEndian a -> Bool
$cisNaN :: forall a. RealFloat a => LittleEndian a -> Bool
scaleFloat :: Int -> LittleEndian a -> LittleEndian a
$cscaleFloat :: forall a. RealFloat a => Int -> LittleEndian a -> LittleEndian a
significand :: LittleEndian a -> LittleEndian a
$csignificand :: forall a. RealFloat a => LittleEndian a -> LittleEndian a
exponent :: LittleEndian a -> Int
$cexponent :: forall a. RealFloat a => LittleEndian a -> Int
encodeFloat :: Integer -> Int -> LittleEndian a
$cencodeFloat :: forall a. RealFloat a => Integer -> Int -> LittleEndian a
decodeFloat :: LittleEndian a -> (Integer, Int)
$cdecodeFloat :: forall a. RealFloat a => LittleEndian a -> (Integer, Int)
floatRange :: LittleEndian a -> (Int, Int)
$cfloatRange :: forall a. RealFloat a => LittleEndian a -> (Int, Int)
floatDigits :: LittleEndian a -> Int
$cfloatDigits :: forall a. RealFloat a => LittleEndian a -> Int
floatRadix :: LittleEndian a -> Integer
$cfloatRadix :: forall a. RealFloat a => LittleEndian a -> Integer
$cp2RealFloat :: forall a. RealFloat a => Floating (LittleEndian a)
$cp1RealFloat :: forall a. RealFloat a => RealFrac (LittleEndian a)
RealFloat
, (forall x. LittleEndian a -> Rep (LittleEndian a) x)
-> (forall x. Rep (LittleEndian a) x -> LittleEndian a)
-> Generic (LittleEndian a)
forall x. Rep (LittleEndian a) x -> LittleEndian a
forall x. LittleEndian a -> Rep (LittleEndian a) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (LittleEndian a) x -> LittleEndian a
forall a x. LittleEndian a -> Rep (LittleEndian a) x
$cto :: forall a x. Rep (LittleEndian a) x -> LittleEndian a
$cfrom :: forall a x. LittleEndian a -> Rep (LittleEndian a) x
Generic)
newtype BigEndian a = BE { BigEndian a -> a
getBigEndian :: a }
deriving ( BigEndian a -> BigEndian a -> Bool
(BigEndian a -> BigEndian a -> Bool)
-> (BigEndian a -> BigEndian a -> Bool) -> Eq (BigEndian a)
forall a. Eq a => BigEndian a -> BigEndian a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BigEndian a -> BigEndian a -> Bool
$c/= :: forall a. Eq a => BigEndian a -> BigEndian a -> Bool
== :: BigEndian a -> BigEndian a -> Bool
$c== :: forall a. Eq a => BigEndian a -> BigEndian a -> Bool
Eq, Eq (BigEndian a)
Eq (BigEndian a)
-> (BigEndian a -> BigEndian a -> Ordering)
-> (BigEndian a -> BigEndian a -> Bool)
-> (BigEndian a -> BigEndian a -> Bool)
-> (BigEndian a -> BigEndian a -> Bool)
-> (BigEndian a -> BigEndian a -> Bool)
-> (BigEndian a -> BigEndian a -> BigEndian a)
-> (BigEndian a -> BigEndian a -> BigEndian a)
-> Ord (BigEndian a)
BigEndian a -> BigEndian a -> Bool
BigEndian a -> BigEndian a -> Ordering
BigEndian a -> BigEndian a -> BigEndian a
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
forall a. Ord a => Eq (BigEndian a)
forall a. Ord a => BigEndian a -> BigEndian a -> Bool
forall a. Ord a => BigEndian a -> BigEndian a -> Ordering
forall a. Ord a => BigEndian a -> BigEndian a -> BigEndian a
min :: BigEndian a -> BigEndian a -> BigEndian a
$cmin :: forall a. Ord a => BigEndian a -> BigEndian a -> BigEndian a
max :: BigEndian a -> BigEndian a -> BigEndian a
$cmax :: forall a. Ord a => BigEndian a -> BigEndian a -> BigEndian a
>= :: BigEndian a -> BigEndian a -> Bool
$c>= :: forall a. Ord a => BigEndian a -> BigEndian a -> Bool
> :: BigEndian a -> BigEndian a -> Bool
$c> :: forall a. Ord a => BigEndian a -> BigEndian a -> Bool
<= :: BigEndian a -> BigEndian a -> Bool
$c<= :: forall a. Ord a => BigEndian a -> BigEndian a -> Bool
< :: BigEndian a -> BigEndian a -> Bool
$c< :: forall a. Ord a => BigEndian a -> BigEndian a -> Bool
compare :: BigEndian a -> BigEndian a -> Ordering
$ccompare :: forall a. Ord a => BigEndian a -> BigEndian a -> Ordering
$cp1Ord :: forall a. Ord a => Eq (BigEndian a)
Ord, Int -> BigEndian a -> ShowS
[BigEndian a] -> ShowS
BigEndian a -> String
(Int -> BigEndian a -> ShowS)
-> (BigEndian a -> String)
-> ([BigEndian a] -> ShowS)
-> Show (BigEndian a)
forall a. Show a => Int -> BigEndian a -> ShowS
forall a. Show a => [BigEndian a] -> ShowS
forall a. Show a => BigEndian a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BigEndian a] -> ShowS
$cshowList :: forall a. Show a => [BigEndian a] -> ShowS
show :: BigEndian a -> String
$cshow :: forall a. Show a => BigEndian a -> String
showsPrec :: Int -> BigEndian a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> BigEndian a -> ShowS
Show, ReadPrec [BigEndian a]
ReadPrec (BigEndian a)
Int -> ReadS (BigEndian a)
ReadS [BigEndian a]
(Int -> ReadS (BigEndian a))
-> ReadS [BigEndian a]
-> ReadPrec (BigEndian a)
-> ReadPrec [BigEndian a]
-> Read (BigEndian a)
forall a. Read a => ReadPrec [BigEndian a]
forall a. Read a => ReadPrec (BigEndian a)
forall a. Read a => Int -> ReadS (BigEndian a)
forall a. Read a => ReadS [BigEndian a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BigEndian a]
$creadListPrec :: forall a. Read a => ReadPrec [BigEndian a]
readPrec :: ReadPrec (BigEndian a)
$creadPrec :: forall a. Read a => ReadPrec (BigEndian a)
readList :: ReadS [BigEndian a]
$creadList :: forall a. Read a => ReadS [BigEndian a]
readsPrec :: Int -> ReadS (BigEndian a)
$creadsPrec :: forall a. Read a => Int -> ReadS (BigEndian a)
Read, Int -> BigEndian a
BigEndian a -> Int
BigEndian a -> [BigEndian a]
BigEndian a -> BigEndian a
BigEndian a -> BigEndian a -> [BigEndian a]
BigEndian a -> BigEndian a -> BigEndian a -> [BigEndian a]
(BigEndian a -> BigEndian a)
-> (BigEndian a -> BigEndian a)
-> (Int -> BigEndian a)
-> (BigEndian a -> Int)
-> (BigEndian a -> [BigEndian a])
-> (BigEndian a -> BigEndian a -> [BigEndian a])
-> (BigEndian a -> BigEndian a -> [BigEndian a])
-> (BigEndian a -> BigEndian a -> BigEndian a -> [BigEndian a])
-> Enum (BigEndian a)
forall a. Enum a => Int -> BigEndian a
forall a. Enum a => BigEndian a -> Int
forall a. Enum a => BigEndian a -> [BigEndian a]
forall a. Enum a => BigEndian a -> BigEndian a
forall a. Enum a => BigEndian a -> BigEndian a -> [BigEndian a]
forall a.
Enum a =>
BigEndian a -> BigEndian a -> BigEndian a -> [BigEndian a]
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: BigEndian a -> BigEndian a -> BigEndian a -> [BigEndian a]
$cenumFromThenTo :: forall a.
Enum a =>
BigEndian a -> BigEndian a -> BigEndian a -> [BigEndian a]
enumFromTo :: BigEndian a -> BigEndian a -> [BigEndian a]
$cenumFromTo :: forall a. Enum a => BigEndian a -> BigEndian a -> [BigEndian a]
enumFromThen :: BigEndian a -> BigEndian a -> [BigEndian a]
$cenumFromThen :: forall a. Enum a => BigEndian a -> BigEndian a -> [BigEndian a]
enumFrom :: BigEndian a -> [BigEndian a]
$cenumFrom :: forall a. Enum a => BigEndian a -> [BigEndian a]
fromEnum :: BigEndian a -> Int
$cfromEnum :: forall a. Enum a => BigEndian a -> Int
toEnum :: Int -> BigEndian a
$ctoEnum :: forall a. Enum a => Int -> BigEndian a
pred :: BigEndian a -> BigEndian a
$cpred :: forall a. Enum a => BigEndian a -> BigEndian a
succ :: BigEndian a -> BigEndian a
$csucc :: forall a. Enum a => BigEndian a -> BigEndian a
Enum
, Integer -> BigEndian a
BigEndian a -> BigEndian a
BigEndian a -> BigEndian a -> BigEndian a
(BigEndian a -> BigEndian a -> BigEndian a)
-> (BigEndian a -> BigEndian a -> BigEndian a)
-> (BigEndian a -> BigEndian a -> BigEndian a)
-> (BigEndian a -> BigEndian a)
-> (BigEndian a -> BigEndian a)
-> (BigEndian a -> BigEndian a)
-> (Integer -> BigEndian a)
-> Num (BigEndian a)
forall a. Num a => Integer -> BigEndian a
forall a. Num a => BigEndian a -> BigEndian a
forall a. Num a => BigEndian a -> BigEndian a -> BigEndian a
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
fromInteger :: Integer -> BigEndian a
$cfromInteger :: forall a. Num a => Integer -> BigEndian a
signum :: BigEndian a -> BigEndian a
$csignum :: forall a. Num a => BigEndian a -> BigEndian a
abs :: BigEndian a -> BigEndian a
$cabs :: forall a. Num a => BigEndian a -> BigEndian a
negate :: BigEndian a -> BigEndian a
$cnegate :: forall a. Num a => BigEndian a -> BigEndian a
* :: BigEndian a -> BigEndian a -> BigEndian a
$c* :: forall a. Num a => BigEndian a -> BigEndian a -> BigEndian a
- :: BigEndian a -> BigEndian a -> BigEndian a
$c- :: forall a. Num a => BigEndian a -> BigEndian a -> BigEndian a
+ :: BigEndian a -> BigEndian a -> BigEndian a
$c+ :: forall a. Num a => BigEndian a -> BigEndian a -> BigEndian a
Num, Enum (BigEndian a)
Real (BigEndian a)
Real (BigEndian a)
-> Enum (BigEndian a)
-> (BigEndian a -> BigEndian a -> BigEndian a)
-> (BigEndian a -> BigEndian a -> BigEndian a)
-> (BigEndian a -> BigEndian a -> BigEndian a)
-> (BigEndian a -> BigEndian a -> BigEndian a)
-> (BigEndian a -> BigEndian a -> (BigEndian a, BigEndian a))
-> (BigEndian a -> BigEndian a -> (BigEndian a, BigEndian a))
-> (BigEndian a -> Integer)
-> Integral (BigEndian a)
BigEndian a -> Integer
BigEndian a -> BigEndian a -> (BigEndian a, BigEndian a)
BigEndian a -> BigEndian a -> BigEndian a
forall a. Integral a => Enum (BigEndian a)
forall a. Integral a => Real (BigEndian a)
forall a. Integral a => BigEndian a -> Integer
forall a.
Integral a =>
BigEndian a -> BigEndian a -> (BigEndian a, BigEndian a)
forall a. Integral a => BigEndian a -> BigEndian a -> BigEndian a
forall a.
Real a
-> Enum a
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> (a, a))
-> (a -> a -> (a, a))
-> (a -> Integer)
-> Integral a
toInteger :: BigEndian a -> Integer
$ctoInteger :: forall a. Integral a => BigEndian a -> Integer
divMod :: BigEndian a -> BigEndian a -> (BigEndian a, BigEndian a)
$cdivMod :: forall a.
Integral a =>
BigEndian a -> BigEndian a -> (BigEndian a, BigEndian a)
quotRem :: BigEndian a -> BigEndian a -> (BigEndian a, BigEndian a)
$cquotRem :: forall a.
Integral a =>
BigEndian a -> BigEndian a -> (BigEndian a, BigEndian a)
mod :: BigEndian a -> BigEndian a -> BigEndian a
$cmod :: forall a. Integral a => BigEndian a -> BigEndian a -> BigEndian a
div :: BigEndian a -> BigEndian a -> BigEndian a
$cdiv :: forall a. Integral a => BigEndian a -> BigEndian a -> BigEndian a
rem :: BigEndian a -> BigEndian a -> BigEndian a
$crem :: forall a. Integral a => BigEndian a -> BigEndian a -> BigEndian a
quot :: BigEndian a -> BigEndian a -> BigEndian a
$cquot :: forall a. Integral a => BigEndian a -> BigEndian a -> BigEndian a
$cp2Integral :: forall a. Integral a => Enum (BigEndian a)
$cp1Integral :: forall a. Integral a => Real (BigEndian a)
Integral, Num (BigEndian a)
Num (BigEndian a)
-> (BigEndian a -> BigEndian a -> BigEndian a)
-> (BigEndian a -> BigEndian a)
-> (Rational -> BigEndian a)
-> Fractional (BigEndian a)
Rational -> BigEndian a
BigEndian a -> BigEndian a
BigEndian a -> BigEndian a -> BigEndian a
forall a. Fractional a => Num (BigEndian a)
forall a. Fractional a => Rational -> BigEndian a
forall a. Fractional a => BigEndian a -> BigEndian a
forall a. Fractional a => BigEndian a -> BigEndian a -> BigEndian a
forall a.
Num a
-> (a -> a -> a) -> (a -> a) -> (Rational -> a) -> Fractional a
fromRational :: Rational -> BigEndian a
$cfromRational :: forall a. Fractional a => Rational -> BigEndian a
recip :: BigEndian a -> BigEndian a
$crecip :: forall a. Fractional a => BigEndian a -> BigEndian a
/ :: BigEndian a -> BigEndian a -> BigEndian a
$c/ :: forall a. Fractional a => BigEndian a -> BigEndian a -> BigEndian a
$cp1Fractional :: forall a. Fractional a => Num (BigEndian a)
Fractional, Fractional (BigEndian a)
BigEndian a
Fractional (BigEndian a)
-> BigEndian a
-> (BigEndian a -> BigEndian a)
-> (BigEndian a -> BigEndian a)
-> (BigEndian a -> BigEndian a)
-> (BigEndian a -> BigEndian a -> BigEndian a)
-> (BigEndian a -> BigEndian a -> BigEndian a)
-> (BigEndian a -> BigEndian a)
-> (BigEndian a -> BigEndian a)
-> (BigEndian a -> BigEndian a)
-> (BigEndian a -> BigEndian a)
-> (BigEndian a -> BigEndian a)
-> (BigEndian a -> BigEndian a)
-> (BigEndian a -> BigEndian a)
-> (BigEndian a -> BigEndian a)
-> (BigEndian a -> BigEndian a)
-> (BigEndian a -> BigEndian a)
-> (BigEndian a -> BigEndian a)
-> (BigEndian a -> BigEndian a)
-> (BigEndian a -> BigEndian a)
-> (BigEndian a -> BigEndian a)
-> (BigEndian a -> BigEndian a)
-> (BigEndian a -> BigEndian a)
-> Floating (BigEndian a)
BigEndian a -> BigEndian a
BigEndian a -> BigEndian a -> BigEndian a
forall a. Floating a => Fractional (BigEndian a)
forall a. Floating a => BigEndian a
forall a. Floating a => BigEndian a -> BigEndian a
forall a. Floating a => BigEndian a -> BigEndian a -> BigEndian a
forall a.
Fractional a
-> a
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> Floating a
log1mexp :: BigEndian a -> BigEndian a
$clog1mexp :: forall a. Floating a => BigEndian a -> BigEndian a
log1pexp :: BigEndian a -> BigEndian a
$clog1pexp :: forall a. Floating a => BigEndian a -> BigEndian a
expm1 :: BigEndian a -> BigEndian a
$cexpm1 :: forall a. Floating a => BigEndian a -> BigEndian a
log1p :: BigEndian a -> BigEndian a
$clog1p :: forall a. Floating a => BigEndian a -> BigEndian a
atanh :: BigEndian a -> BigEndian a
$catanh :: forall a. Floating a => BigEndian a -> BigEndian a
acosh :: BigEndian a -> BigEndian a
$cacosh :: forall a. Floating a => BigEndian a -> BigEndian a
asinh :: BigEndian a -> BigEndian a
$casinh :: forall a. Floating a => BigEndian a -> BigEndian a
tanh :: BigEndian a -> BigEndian a
$ctanh :: forall a. Floating a => BigEndian a -> BigEndian a
cosh :: BigEndian a -> BigEndian a
$ccosh :: forall a. Floating a => BigEndian a -> BigEndian a
sinh :: BigEndian a -> BigEndian a
$csinh :: forall a. Floating a => BigEndian a -> BigEndian a
atan :: BigEndian a -> BigEndian a
$catan :: forall a. Floating a => BigEndian a -> BigEndian a
acos :: BigEndian a -> BigEndian a
$cacos :: forall a. Floating a => BigEndian a -> BigEndian a
asin :: BigEndian a -> BigEndian a
$casin :: forall a. Floating a => BigEndian a -> BigEndian a
tan :: BigEndian a -> BigEndian a
$ctan :: forall a. Floating a => BigEndian a -> BigEndian a
cos :: BigEndian a -> BigEndian a
$ccos :: forall a. Floating a => BigEndian a -> BigEndian a
sin :: BigEndian a -> BigEndian a
$csin :: forall a. Floating a => BigEndian a -> BigEndian a
logBase :: BigEndian a -> BigEndian a -> BigEndian a
$clogBase :: forall a. Floating a => BigEndian a -> BigEndian a -> BigEndian a
** :: BigEndian a -> BigEndian a -> BigEndian a
$c** :: forall a. Floating a => BigEndian a -> BigEndian a -> BigEndian a
sqrt :: BigEndian a -> BigEndian a
$csqrt :: forall a. Floating a => BigEndian a -> BigEndian a
log :: BigEndian a -> BigEndian a
$clog :: forall a. Floating a => BigEndian a -> BigEndian a
exp :: BigEndian a -> BigEndian a
$cexp :: forall a. Floating a => BigEndian a -> BigEndian a
pi :: BigEndian a
$cpi :: forall a. Floating a => BigEndian a
$cp1Floating :: forall a. Floating a => Fractional (BigEndian a)
Floating, Num (BigEndian a)
Ord (BigEndian a)
Num (BigEndian a)
-> Ord (BigEndian a)
-> (BigEndian a -> Rational)
-> Real (BigEndian a)
BigEndian a -> Rational
forall a. Num a -> Ord a -> (a -> Rational) -> Real a
forall a. Real a => Num (BigEndian a)
forall a. Real a => Ord (BigEndian a)
forall a. Real a => BigEndian a -> Rational
toRational :: BigEndian a -> Rational
$ctoRational :: forall a. Real a => BigEndian a -> Rational
$cp2Real :: forall a. Real a => Ord (BigEndian a)
$cp1Real :: forall a. Real a => Num (BigEndian a)
Real, Fractional (BigEndian a)
Real (BigEndian a)
Real (BigEndian a)
-> Fractional (BigEndian a)
-> (forall b. Integral b => BigEndian a -> (b, BigEndian a))
-> (forall b. Integral b => BigEndian a -> b)
-> (forall b. Integral b => BigEndian a -> b)
-> (forall b. Integral b => BigEndian a -> b)
-> (forall b. Integral b => BigEndian a -> b)
-> RealFrac (BigEndian a)
BigEndian a -> b
BigEndian a -> b
BigEndian a -> b
BigEndian a -> b
BigEndian a -> (b, BigEndian a)
forall b. Integral b => BigEndian a -> b
forall b. Integral b => BigEndian a -> (b, BigEndian a)
forall a.
Real a
-> Fractional a
-> (forall b. Integral b => a -> (b, a))
-> (forall b. Integral b => a -> b)
-> (forall b. Integral b => a -> b)
-> (forall b. Integral b => a -> b)
-> (forall b. Integral b => a -> b)
-> RealFrac a
forall a. RealFrac a => Fractional (BigEndian a)
forall a. RealFrac a => Real (BigEndian a)
forall a b. (RealFrac a, Integral b) => BigEndian a -> b
forall a b.
(RealFrac a, Integral b) =>
BigEndian a -> (b, BigEndian a)
floor :: BigEndian a -> b
$cfloor :: forall a b. (RealFrac a, Integral b) => BigEndian a -> b
ceiling :: BigEndian a -> b
$cceiling :: forall a b. (RealFrac a, Integral b) => BigEndian a -> b
round :: BigEndian a -> b
$cround :: forall a b. (RealFrac a, Integral b) => BigEndian a -> b
truncate :: BigEndian a -> b
$ctruncate :: forall a b. (RealFrac a, Integral b) => BigEndian a -> b
properFraction :: BigEndian a -> (b, BigEndian a)
$cproperFraction :: forall a b.
(RealFrac a, Integral b) =>
BigEndian a -> (b, BigEndian a)
$cp2RealFrac :: forall a. RealFrac a => Fractional (BigEndian a)
$cp1RealFrac :: forall a. RealFrac a => Real (BigEndian a)
RealFrac, Floating (BigEndian a)
RealFrac (BigEndian a)
RealFrac (BigEndian a)
-> Floating (BigEndian a)
-> (BigEndian a -> Integer)
-> (BigEndian a -> Int)
-> (BigEndian a -> (Int, Int))
-> (BigEndian a -> (Integer, Int))
-> (Integer -> Int -> BigEndian a)
-> (BigEndian a -> Int)
-> (BigEndian a -> BigEndian a)
-> (Int -> BigEndian a -> BigEndian a)
-> (BigEndian a -> Bool)
-> (BigEndian a -> Bool)
-> (BigEndian a -> Bool)
-> (BigEndian a -> Bool)
-> (BigEndian a -> Bool)
-> (BigEndian a -> BigEndian a -> BigEndian a)
-> RealFloat (BigEndian a)
Int -> BigEndian a -> BigEndian a
Integer -> Int -> BigEndian a
BigEndian a -> Bool
BigEndian a -> Int
BigEndian a -> Integer
BigEndian a -> (Int, Int)
BigEndian a -> (Integer, Int)
BigEndian a -> BigEndian a
BigEndian a -> BigEndian a -> BigEndian a
forall a. RealFloat a => Floating (BigEndian a)
forall a. RealFloat a => RealFrac (BigEndian a)
forall a. RealFloat a => Int -> BigEndian a -> BigEndian a
forall a. RealFloat a => Integer -> Int -> BigEndian a
forall a. RealFloat a => BigEndian a -> Bool
forall a. RealFloat a => BigEndian a -> Int
forall a. RealFloat a => BigEndian a -> Integer
forall a. RealFloat a => BigEndian a -> (Int, Int)
forall a. RealFloat a => BigEndian a -> (Integer, Int)
forall a. RealFloat a => BigEndian a -> BigEndian a
forall a. RealFloat a => BigEndian a -> BigEndian a -> BigEndian a
forall a.
RealFrac a
-> Floating a
-> (a -> Integer)
-> (a -> Int)
-> (a -> (Int, Int))
-> (a -> (Integer, Int))
-> (Integer -> Int -> a)
-> (a -> Int)
-> (a -> a)
-> (Int -> a -> a)
-> (a -> Bool)
-> (a -> Bool)
-> (a -> Bool)
-> (a -> Bool)
-> (a -> Bool)
-> (a -> a -> a)
-> RealFloat a
atan2 :: BigEndian a -> BigEndian a -> BigEndian a
$catan2 :: forall a. RealFloat a => BigEndian a -> BigEndian a -> BigEndian a
isIEEE :: BigEndian a -> Bool
$cisIEEE :: forall a. RealFloat a => BigEndian a -> Bool
isNegativeZero :: BigEndian a -> Bool
$cisNegativeZero :: forall a. RealFloat a => BigEndian a -> Bool
isDenormalized :: BigEndian a -> Bool
$cisDenormalized :: forall a. RealFloat a => BigEndian a -> Bool
isInfinite :: BigEndian a -> Bool
$cisInfinite :: forall a. RealFloat a => BigEndian a -> Bool
isNaN :: BigEndian a -> Bool
$cisNaN :: forall a. RealFloat a => BigEndian a -> Bool
scaleFloat :: Int -> BigEndian a -> BigEndian a
$cscaleFloat :: forall a. RealFloat a => Int -> BigEndian a -> BigEndian a
significand :: BigEndian a -> BigEndian a
$csignificand :: forall a. RealFloat a => BigEndian a -> BigEndian a
exponent :: BigEndian a -> Int
$cexponent :: forall a. RealFloat a => BigEndian a -> Int
encodeFloat :: Integer -> Int -> BigEndian a
$cencodeFloat :: forall a. RealFloat a => Integer -> Int -> BigEndian a
decodeFloat :: BigEndian a -> (Integer, Int)
$cdecodeFloat :: forall a. RealFloat a => BigEndian a -> (Integer, Int)
floatRange :: BigEndian a -> (Int, Int)
$cfloatRange :: forall a. RealFloat a => BigEndian a -> (Int, Int)
floatDigits :: BigEndian a -> Int
$cfloatDigits :: forall a. RealFloat a => BigEndian a -> Int
floatRadix :: BigEndian a -> Integer
$cfloatRadix :: forall a. RealFloat a => BigEndian a -> Integer
$cp2RealFloat :: forall a. RealFloat a => Floating (BigEndian a)
$cp1RealFloat :: forall a. RealFloat a => RealFrac (BigEndian a)
RealFloat
, (forall x. BigEndian a -> Rep (BigEndian a) x)
-> (forall x. Rep (BigEndian a) x -> BigEndian a)
-> Generic (BigEndian a)
forall x. Rep (BigEndian a) x -> BigEndian a
forall x. BigEndian a -> Rep (BigEndian a) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (BigEndian a) x -> BigEndian a
forall a x. BigEndian a -> Rep (BigEndian a) x
$cto :: forall a x. Rep (BigEndian a) x -> BigEndian a
$cfrom :: forall a x. BigEndian a -> Rep (BigEndian a) x
Generic)
class HasLittleEndian a where
peekLE :: Ptr a -> IO a
pokeLE :: Ptr a -> a -> IO ()
class HasBigEndian a where
peekBE :: Ptr a -> IO a
pokeBE :: Ptr a -> a -> IO ()
instance (HasLittleEndian a, Storable a) => Storable (LittleEndian a) where
sizeOf :: LittleEndian a -> Int
sizeOf (LE a
a) = a -> Int
forall a. Storable a => a -> Int
sizeOf a
a
alignment :: LittleEndian a -> Int
alignment (LE a
a) = a -> Int
forall a. Storable a => a -> Int
alignment a
a
peek :: Ptr (LittleEndian a) -> IO (LittleEndian a)
peek Ptr (LittleEndian a)
p = a -> LittleEndian a
forall a. a -> LittleEndian a
LE (a -> LittleEndian a) -> IO a -> IO (LittleEndian a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` Ptr a -> IO a
forall a. HasLittleEndian a => Ptr a -> IO a
peekLE (Ptr (LittleEndian a) -> Ptr a
forall a b. Ptr a -> Ptr b
castPtr Ptr (LittleEndian a)
p)
poke :: Ptr (LittleEndian a) -> LittleEndian a -> IO ()
poke Ptr (LittleEndian a)
p (LE a
a) = Ptr a -> a -> IO ()
forall a. HasLittleEndian a => Ptr a -> a -> IO ()
pokeLE (Ptr (LittleEndian a) -> Ptr a
forall a b. Ptr a -> Ptr b
castPtr Ptr (LittleEndian a)
p) a
a
instance (HasBigEndian a, Storable a) => Storable (BigEndian a) where
sizeOf :: BigEndian a -> Int
sizeOf (BE a
a) = a -> Int
forall a. Storable a => a -> Int
sizeOf a
a
alignment :: BigEndian a -> Int
alignment (BE a
a) = a -> Int
forall a. Storable a => a -> Int
alignment a
a
peek :: Ptr (BigEndian a) -> IO (BigEndian a)
peek Ptr (BigEndian a)
p = a -> BigEndian a
forall a. a -> BigEndian a
BE (a -> BigEndian a) -> IO a -> IO (BigEndian a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` Ptr a -> IO a
forall a. HasBigEndian a => Ptr a -> IO a
peekBE (Ptr (BigEndian a) -> Ptr a
forall a b. Ptr a -> Ptr b
castPtr Ptr (BigEndian a)
p)
poke :: Ptr (BigEndian a) -> BigEndian a -> IO ()
poke Ptr (BigEndian a)
p (BE a
a) = Ptr a -> a -> IO ()
forall a. HasBigEndian a => Ptr a -> a -> IO ()
pokeBE (Ptr (BigEndian a) -> Ptr a
forall a b. Ptr a -> Ptr b
castPtr Ptr (BigEndian a)
p) a
a
fork :: (a1 -> b1 -> c) -> (a0 -> a1) -> (b0 -> b1) -> a0 -> b0 -> c
fork :: (a1 -> b1 -> c) -> (a0 -> a1) -> (b0 -> b1) -> a0 -> b0 -> c
fork a1 -> b1 -> c
f a0 -> a1
onX b0 -> b1
onY = \a0
x b0
y -> a1 -> b1 -> c
f (a0 -> a1
onX a0
x) (b0 -> b1
onY b0
y)
instance HasLittleEndian Int16 where
peekLE :: Ptr Int16 -> IO Int16
peekLE = IO Word16 -> IO Int16
forall a b. a -> b
unsafeCoerce (IO Word16 -> IO Int16)
-> (Ptr Int16 -> IO Word16) -> Ptr Int16 -> IO Int16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Word8 -> IO Word16
getWord16le (Ptr Word8 -> IO Word16)
-> (Ptr Int16 -> Ptr Word8) -> Ptr Int16 -> IO Word16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Int16 -> Ptr Word8
forall a b. Ptr a -> Ptr b
castPtr
pokeLE :: Ptr Int16 -> Int16 -> IO ()
pokeLE = (Ptr Word8 -> Word16 -> IO ())
-> (Ptr Int16 -> Ptr Word8)
-> (Int16 -> Word16)
-> Ptr Int16
-> Int16
-> IO ()
forall a1 b1 c a0 b0.
(a1 -> b1 -> c) -> (a0 -> a1) -> (b0 -> b1) -> a0 -> b0 -> c
fork Ptr Word8 -> Word16 -> IO ()
putWord16le Ptr Int16 -> Ptr Word8
forall a b. Ptr a -> Ptr b
castPtr Int16 -> Word16
forall a b. a -> b
unsafeCoerce
instance HasLittleEndian Int32 where
peekLE :: Ptr Int32 -> IO Int32
peekLE = IO Word32 -> IO Int32
forall a b. a -> b
unsafeCoerce (IO Word32 -> IO Int32)
-> (Ptr Int32 -> IO Word32) -> Ptr Int32 -> IO Int32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Word8 -> IO Word32
getWord32le (Ptr Word8 -> IO Word32)
-> (Ptr Int32 -> Ptr Word8) -> Ptr Int32 -> IO Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Int32 -> Ptr Word8
forall a b. Ptr a -> Ptr b
castPtr
pokeLE :: Ptr Int32 -> Int32 -> IO ()
pokeLE = (Ptr Word8 -> Word32 -> IO ())
-> (Ptr Int32 -> Ptr Word8)
-> (Int32 -> Word32)
-> Ptr Int32
-> Int32
-> IO ()
forall a1 b1 c a0 b0.
(a1 -> b1 -> c) -> (a0 -> a1) -> (b0 -> b1) -> a0 -> b0 -> c
fork Ptr Word8 -> Word32 -> IO ()
putWord32le Ptr Int32 -> Ptr Word8
forall a b. Ptr a -> Ptr b
castPtr Int32 -> Word32
forall a b. a -> b
unsafeCoerce
instance HasLittleEndian Int64 where
peekLE :: Ptr Int64 -> IO Int64
peekLE = IO Word64 -> IO Int64
forall a b. a -> b
unsafeCoerce (IO Word64 -> IO Int64)
-> (Ptr Int64 -> IO Word64) -> Ptr Int64 -> IO Int64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Word8 -> IO Word64
getWord64le (Ptr Word8 -> IO Word64)
-> (Ptr Int64 -> Ptr Word8) -> Ptr Int64 -> IO Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Int64 -> Ptr Word8
forall a b. Ptr a -> Ptr b
castPtr
pokeLE :: Ptr Int64 -> Int64 -> IO ()
pokeLE = (Ptr Word8 -> Word64 -> IO ())
-> (Ptr Int64 -> Ptr Word8)
-> (Int64 -> Word64)
-> Ptr Int64
-> Int64
-> IO ()
forall a1 b1 c a0 b0.
(a1 -> b1 -> c) -> (a0 -> a1) -> (b0 -> b1) -> a0 -> b0 -> c
fork Ptr Word8 -> Word64 -> IO ()
putWord64le Ptr Int64 -> Ptr Word8
forall a b. Ptr a -> Ptr b
castPtr Int64 -> Word64
forall a b. a -> b
unsafeCoerce
instance HasLittleEndian Word16 where
peekLE :: Ptr Word16 -> IO Word16
peekLE = IO Word16 -> IO Word16
forall a b. a -> b
unsafeCoerce (IO Word16 -> IO Word16)
-> (Ptr Word16 -> IO Word16) -> Ptr Word16 -> IO Word16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Word8 -> IO Word16
getWord16le (Ptr Word8 -> IO Word16)
-> (Ptr Word16 -> Ptr Word8) -> Ptr Word16 -> IO Word16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Word16 -> Ptr Word8
forall a b. Ptr a -> Ptr b
castPtr
pokeLE :: Ptr Word16 -> Word16 -> IO ()
pokeLE = (Ptr Word8 -> Word16 -> IO ())
-> (Ptr Word16 -> Ptr Word8)
-> (Word16 -> Word16)
-> Ptr Word16
-> Word16
-> IO ()
forall a1 b1 c a0 b0.
(a1 -> b1 -> c) -> (a0 -> a1) -> (b0 -> b1) -> a0 -> b0 -> c
fork Ptr Word8 -> Word16 -> IO ()
putWord16le Ptr Word16 -> Ptr Word8
forall a b. Ptr a -> Ptr b
castPtr Word16 -> Word16
forall a b. a -> b
unsafeCoerce
instance HasLittleEndian Word32 where
peekLE :: Ptr Word32 -> IO Word32
peekLE = IO Word32 -> IO Word32
forall a b. a -> b
unsafeCoerce (IO Word32 -> IO Word32)
-> (Ptr Word32 -> IO Word32) -> Ptr Word32 -> IO Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Word8 -> IO Word32
getWord32le (Ptr Word8 -> IO Word32)
-> (Ptr Word32 -> Ptr Word8) -> Ptr Word32 -> IO Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Word32 -> Ptr Word8
forall a b. Ptr a -> Ptr b
castPtr
pokeLE :: Ptr Word32 -> Word32 -> IO ()
pokeLE = (Ptr Word8 -> Word32 -> IO ())
-> (Ptr Word32 -> Ptr Word8)
-> (Word32 -> Word32)
-> Ptr Word32
-> Word32
-> IO ()
forall a1 b1 c a0 b0.
(a1 -> b1 -> c) -> (a0 -> a1) -> (b0 -> b1) -> a0 -> b0 -> c
fork Ptr Word8 -> Word32 -> IO ()
putWord32le Ptr Word32 -> Ptr Word8
forall a b. Ptr a -> Ptr b
castPtr Word32 -> Word32
forall a b. a -> b
unsafeCoerce
instance HasLittleEndian Word64 where
peekLE :: Ptr Word64 -> IO Word64
peekLE = IO Word64 -> IO Word64
forall a b. a -> b
unsafeCoerce (IO Word64 -> IO Word64)
-> (Ptr Word64 -> IO Word64) -> Ptr Word64 -> IO Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Word8 -> IO Word64
getWord64le (Ptr Word8 -> IO Word64)
-> (Ptr Word64 -> Ptr Word8) -> Ptr Word64 -> IO Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Word64 -> Ptr Word8
forall a b. Ptr a -> Ptr b
castPtr
pokeLE :: Ptr Word64 -> Word64 -> IO ()
pokeLE = (Ptr Word8 -> Word64 -> IO ())
-> (Ptr Word64 -> Ptr Word8)
-> (Word64 -> Word64)
-> Ptr Word64
-> Word64
-> IO ()
forall a1 b1 c a0 b0.
(a1 -> b1 -> c) -> (a0 -> a1) -> (b0 -> b1) -> a0 -> b0 -> c
fork Ptr Word8 -> Word64 -> IO ()
putWord64le Ptr Word64 -> Ptr Word8
forall a b. Ptr a -> Ptr b
castPtr Word64 -> Word64
forall a b. a -> b
unsafeCoerce
instance HasLittleEndian Float where
peekLE :: Ptr Float -> IO Float
peekLE = IO Word32 -> IO Float
forall a b. a -> b
unsafeCoerce (IO Word32 -> IO Float)
-> (Ptr Float -> IO Word32) -> Ptr Float -> IO Float
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Word8 -> IO Word32
getWord32le (Ptr Word8 -> IO Word32)
-> (Ptr Float -> Ptr Word8) -> Ptr Float -> IO Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Float -> Ptr Word8
forall a b. Ptr a -> Ptr b
castPtr
pokeLE :: Ptr Float -> Float -> IO ()
pokeLE = (Ptr Word8 -> Word32 -> IO ())
-> (Ptr Float -> Ptr Word8)
-> (Float -> Word32)
-> Ptr Float
-> Float
-> IO ()
forall a1 b1 c a0 b0.
(a1 -> b1 -> c) -> (a0 -> a1) -> (b0 -> b1) -> a0 -> b0 -> c
fork Ptr Word8 -> Word32 -> IO ()
putWord32le Ptr Float -> Ptr Word8
forall a b. Ptr a -> Ptr b
castPtr Float -> Word32
forall a b. a -> b
unsafeCoerce
instance HasLittleEndian Double where
peekLE :: Ptr Double -> IO Double
peekLE = IO Word64 -> IO Double
forall a b. a -> b
unsafeCoerce (IO Word64 -> IO Double)
-> (Ptr Double -> IO Word64) -> Ptr Double -> IO Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Word8 -> IO Word64
getWord64le (Ptr Word8 -> IO Word64)
-> (Ptr Double -> Ptr Word8) -> Ptr Double -> IO Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Double -> Ptr Word8
forall a b. Ptr a -> Ptr b
castPtr
pokeLE :: Ptr Double -> Double -> IO ()
pokeLE = (Ptr Word8 -> Word64 -> IO ())
-> (Ptr Double -> Ptr Word8)
-> (Double -> Word64)
-> Ptr Double
-> Double
-> IO ()
forall a1 b1 c a0 b0.
(a1 -> b1 -> c) -> (a0 -> a1) -> (b0 -> b1) -> a0 -> b0 -> c
fork Ptr Word8 -> Word64 -> IO ()
putWord64le Ptr Double -> Ptr Word8
forall a b. Ptr a -> Ptr b
castPtr Double -> Word64
forall a b. a -> b
unsafeCoerce
instance HasBigEndian Int16 where
peekBE :: Ptr Int16 -> IO Int16
peekBE = IO Word16 -> IO Int16
forall a b. a -> b
unsafeCoerce (IO Word16 -> IO Int16)
-> (Ptr Int16 -> IO Word16) -> Ptr Int16 -> IO Int16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Word8 -> IO Word16
getWord16be (Ptr Word8 -> IO Word16)
-> (Ptr Int16 -> Ptr Word8) -> Ptr Int16 -> IO Word16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Int16 -> Ptr Word8
forall a b. Ptr a -> Ptr b
castPtr
pokeBE :: Ptr Int16 -> Int16 -> IO ()
pokeBE = (Ptr Word8 -> Word16 -> IO ())
-> (Ptr Int16 -> Ptr Word8)
-> (Int16 -> Word16)
-> Ptr Int16
-> Int16
-> IO ()
forall a1 b1 c a0 b0.
(a1 -> b1 -> c) -> (a0 -> a1) -> (b0 -> b1) -> a0 -> b0 -> c
fork Ptr Word8 -> Word16 -> IO ()
putWord16be Ptr Int16 -> Ptr Word8
forall a b. Ptr a -> Ptr b
castPtr Int16 -> Word16
forall a b. a -> b
unsafeCoerce
instance HasBigEndian Int32 where
peekBE :: Ptr Int32 -> IO Int32
peekBE = IO Word32 -> IO Int32
forall a b. a -> b
unsafeCoerce (IO Word32 -> IO Int32)
-> (Ptr Int32 -> IO Word32) -> Ptr Int32 -> IO Int32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Word8 -> IO Word32
getWord32be (Ptr Word8 -> IO Word32)
-> (Ptr Int32 -> Ptr Word8) -> Ptr Int32 -> IO Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Int32 -> Ptr Word8
forall a b. Ptr a -> Ptr b
castPtr
pokeBE :: Ptr Int32 -> Int32 -> IO ()
pokeBE = (Ptr Word8 -> Word32 -> IO ())
-> (Ptr Int32 -> Ptr Word8)
-> (Int32 -> Word32)
-> Ptr Int32
-> Int32
-> IO ()
forall a1 b1 c a0 b0.
(a1 -> b1 -> c) -> (a0 -> a1) -> (b0 -> b1) -> a0 -> b0 -> c
fork Ptr Word8 -> Word32 -> IO ()
putWord32be Ptr Int32 -> Ptr Word8
forall a b. Ptr a -> Ptr b
castPtr Int32 -> Word32
forall a b. a -> b
unsafeCoerce
instance HasBigEndian Int64 where
peekBE :: Ptr Int64 -> IO Int64
peekBE = IO Word64 -> IO Int64
forall a b. a -> b
unsafeCoerce (IO Word64 -> IO Int64)
-> (Ptr Int64 -> IO Word64) -> Ptr Int64 -> IO Int64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Word8 -> IO Word64
getWord64be (Ptr Word8 -> IO Word64)
-> (Ptr Int64 -> Ptr Word8) -> Ptr Int64 -> IO Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Int64 -> Ptr Word8
forall a b. Ptr a -> Ptr b
castPtr
pokeBE :: Ptr Int64 -> Int64 -> IO ()
pokeBE = (Ptr Word8 -> Word64 -> IO ())
-> (Ptr Int64 -> Ptr Word8)
-> (Int64 -> Word64)
-> Ptr Int64
-> Int64
-> IO ()
forall a1 b1 c a0 b0.
(a1 -> b1 -> c) -> (a0 -> a1) -> (b0 -> b1) -> a0 -> b0 -> c
fork Ptr Word8 -> Word64 -> IO ()
putWord64be Ptr Int64 -> Ptr Word8
forall a b. Ptr a -> Ptr b
castPtr Int64 -> Word64
forall a b. a -> b
unsafeCoerce
instance HasBigEndian Word16 where
peekBE :: Ptr Word16 -> IO Word16
peekBE = IO Word16 -> IO Word16
forall a b. a -> b
unsafeCoerce (IO Word16 -> IO Word16)
-> (Ptr Word16 -> IO Word16) -> Ptr Word16 -> IO Word16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Word8 -> IO Word16
getWord16be (Ptr Word8 -> IO Word16)
-> (Ptr Word16 -> Ptr Word8) -> Ptr Word16 -> IO Word16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Word16 -> Ptr Word8
forall a b. Ptr a -> Ptr b
castPtr
pokeBE :: Ptr Word16 -> Word16 -> IO ()
pokeBE = (Ptr Word8 -> Word16 -> IO ())
-> (Ptr Word16 -> Ptr Word8)
-> (Word16 -> Word16)
-> Ptr Word16
-> Word16
-> IO ()
forall a1 b1 c a0 b0.
(a1 -> b1 -> c) -> (a0 -> a1) -> (b0 -> b1) -> a0 -> b0 -> c
fork Ptr Word8 -> Word16 -> IO ()
putWord16be Ptr Word16 -> Ptr Word8
forall a b. Ptr a -> Ptr b
castPtr Word16 -> Word16
forall a b. a -> b
unsafeCoerce
instance HasBigEndian Word32 where
peekBE :: Ptr Word32 -> IO Word32
peekBE = IO Word32 -> IO Word32
forall a b. a -> b
unsafeCoerce (IO Word32 -> IO Word32)
-> (Ptr Word32 -> IO Word32) -> Ptr Word32 -> IO Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Word8 -> IO Word32
getWord32be (Ptr Word8 -> IO Word32)
-> (Ptr Word32 -> Ptr Word8) -> Ptr Word32 -> IO Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Word32 -> Ptr Word8
forall a b. Ptr a -> Ptr b
castPtr
pokeBE :: Ptr Word32 -> Word32 -> IO ()
pokeBE = (Ptr Word8 -> Word32 -> IO ())
-> (Ptr Word32 -> Ptr Word8)
-> (Word32 -> Word32)
-> Ptr Word32
-> Word32
-> IO ()
forall a1 b1 c a0 b0.
(a1 -> b1 -> c) -> (a0 -> a1) -> (b0 -> b1) -> a0 -> b0 -> c
fork Ptr Word8 -> Word32 -> IO ()
putWord32be Ptr Word32 -> Ptr Word8
forall a b. Ptr a -> Ptr b
castPtr Word32 -> Word32
forall a b. a -> b
unsafeCoerce
instance HasBigEndian Word64 where
peekBE :: Ptr Word64 -> IO Word64
peekBE = IO Word64 -> IO Word64
forall a b. a -> b
unsafeCoerce (IO Word64 -> IO Word64)
-> (Ptr Word64 -> IO Word64) -> Ptr Word64 -> IO Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Word8 -> IO Word64
getWord64be (Ptr Word8 -> IO Word64)
-> (Ptr Word64 -> Ptr Word8) -> Ptr Word64 -> IO Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Word64 -> Ptr Word8
forall a b. Ptr a -> Ptr b
castPtr
pokeBE :: Ptr Word64 -> Word64 -> IO ()
pokeBE = (Ptr Word8 -> Word64 -> IO ())
-> (Ptr Word64 -> Ptr Word8)
-> (Word64 -> Word64)
-> Ptr Word64
-> Word64
-> IO ()
forall a1 b1 c a0 b0.
(a1 -> b1 -> c) -> (a0 -> a1) -> (b0 -> b1) -> a0 -> b0 -> c
fork Ptr Word8 -> Word64 -> IO ()
putWord64be Ptr Word64 -> Ptr Word8
forall a b. Ptr a -> Ptr b
castPtr Word64 -> Word64
forall a b. a -> b
unsafeCoerce
instance HasBigEndian Float where
peekBE :: Ptr Float -> IO Float
peekBE = IO Word32 -> IO Float
forall a b. a -> b
unsafeCoerce (IO Word32 -> IO Float)
-> (Ptr Float -> IO Word32) -> Ptr Float -> IO Float
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Word8 -> IO Word32
getWord32be (Ptr Word8 -> IO Word32)
-> (Ptr Float -> Ptr Word8) -> Ptr Float -> IO Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Float -> Ptr Word8
forall a b. Ptr a -> Ptr b
castPtr
pokeBE :: Ptr Float -> Float -> IO ()
pokeBE = (Ptr Word8 -> Word32 -> IO ())
-> (Ptr Float -> Ptr Word8)
-> (Float -> Word32)
-> Ptr Float
-> Float
-> IO ()
forall a1 b1 c a0 b0.
(a1 -> b1 -> c) -> (a0 -> a1) -> (b0 -> b1) -> a0 -> b0 -> c
fork Ptr Word8 -> Word32 -> IO ()
putWord32be Ptr Float -> Ptr Word8
forall a b. Ptr a -> Ptr b
castPtr Float -> Word32
forall a b. a -> b
unsafeCoerce
instance HasBigEndian Double where
peekBE :: Ptr Double -> IO Double
peekBE = IO Word64 -> IO Double
forall a b. a -> b
unsafeCoerce (IO Word64 -> IO Double)
-> (Ptr Double -> IO Word64) -> Ptr Double -> IO Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Word8 -> IO Word64
getWord64be (Ptr Word8 -> IO Word64)
-> (Ptr Double -> Ptr Word8) -> Ptr Double -> IO Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Double -> Ptr Word8
forall a b. Ptr a -> Ptr b
castPtr
pokeBE :: Ptr Double -> Double -> IO ()
pokeBE = (Ptr Word8 -> Word64 -> IO ())
-> (Ptr Double -> Ptr Word8)
-> (Double -> Word64)
-> Ptr Double
-> Double
-> IO ()
forall a1 b1 c a0 b0.
(a1 -> b1 -> c) -> (a0 -> a1) -> (b0 -> b1) -> a0 -> b0 -> c
fork Ptr Word8 -> Word64 -> IO ()
putWord64be Ptr Double -> Ptr Word8
forall a b. Ptr a -> Ptr b
castPtr Double -> Word64
forall a b. a -> b
unsafeCoerce
putWord16be :: Ptr Word8 -> Word16 -> IO ()
putWord16be :: Ptr Word8 -> Word16 -> IO ()
putWord16be = if ByteOrder
byteOrder ByteOrder -> ByteOrder -> Bool
forall a. Eq a => a -> a -> Bool
== ByteOrder
BigEndian
then \Ptr Word8
p Word16
w -> Ptr Word16 -> Word16 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word8 -> Ptr Word16
forall a b. Ptr a -> Ptr b
castPtr Ptr Word8
p) Word16
w
else \Ptr Word8
p Word16
w -> do
Ptr Word8 -> Word8 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr Word8
p (Word16 -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word16 -> Int -> Word16
shiftr_w16 Word16
w Int
8) :: Word8)
Ptr Word8 -> Word8 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word8
p Ptr Word8 -> Int -> Ptr Word8
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
1) (Word16 -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word16
w) :: Word8)
{-# INLINE putWord16be #-}
putWord16le :: Ptr Word8 -> Word16 -> IO ()
putWord16le :: Ptr Word8 -> Word16 -> IO ()
putWord16le = if ByteOrder
byteOrder ByteOrder -> ByteOrder -> Bool
forall a. Eq a => a -> a -> Bool
== ByteOrder
LittleEndian
then \Ptr Word8
p Word16
w -> Ptr Word16 -> Word16 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word8 -> Ptr Word16
forall a b. Ptr a -> Ptr b
castPtr Ptr Word8
p) Word16
w
else \Ptr Word8
p Word16
w -> do
Ptr Word8 -> Word8 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr Word8
p (Word16 -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word16
w) :: Word8)
Ptr Word8 -> Word8 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word8
p Ptr Word8 -> Int -> Ptr Word8
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
1) (Word16 -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word16 -> Int -> Word16
shiftr_w16 Word16
w Int
8) :: Word8)
{-# INLINE putWord16le #-}
putWord32be :: Ptr Word8 -> Word32 -> IO ()
putWord32be :: Ptr Word8 -> Word32 -> IO ()
putWord32be = if ByteOrder
byteOrder ByteOrder -> ByteOrder -> Bool
forall a. Eq a => a -> a -> Bool
== ByteOrder
BigEndian
then \Ptr Word8
p Word32
w -> Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word8 -> Ptr Word32
forall a b. Ptr a -> Ptr b
castPtr Ptr Word8
p) Word32
w
else \Ptr Word8
p Word32
w -> do
Ptr Word8 -> Word8 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr Word8
p (Word32 -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32 -> Int -> Word32
shiftr_w32 Word32
w Int
24) :: Word8)
Ptr Word8 -> Word8 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word8
p Ptr Word8 -> Int -> Ptr Word8
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
1) (Word32 -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32 -> Int -> Word32
shiftr_w32 Word32
w Int
16) :: Word8)
Ptr Word8 -> Word8 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word8
p Ptr Word8 -> Int -> Ptr Word8
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
2) (Word32 -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32 -> Int -> Word32
shiftr_w32 Word32
w Int
8) :: Word8)
Ptr Word8 -> Word8 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word8
p Ptr Word8 -> Int -> Ptr Word8
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
3) (Word32 -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32
w) :: Word8)
{-# INLINE putWord32be #-}
putWord32le :: Ptr Word8 -> Word32 -> IO ()
putWord32le :: Ptr Word8 -> Word32 -> IO ()
putWord32le = if ByteOrder
byteOrder ByteOrder -> ByteOrder -> Bool
forall a. Eq a => a -> a -> Bool
== ByteOrder
LittleEndian
then \Ptr Word8
p Word32
w -> Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word8 -> Ptr Word32
forall a b. Ptr a -> Ptr b
castPtr Ptr Word8
p) Word32
w
else \Ptr Word8
p Word32
w -> do
Ptr Word8 -> Word8 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr Word8
p (Word32 -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32
w) :: Word8)
Ptr Word8 -> Word8 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word8
p Ptr Word8 -> Int -> Ptr Word8
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
1) (Word32 -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32 -> Int -> Word32
shiftr_w32 Word32
w Int
8) :: Word8)
Ptr Word8 -> Word8 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word8
p Ptr Word8 -> Int -> Ptr Word8
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
2) (Word32 -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32 -> Int -> Word32
shiftr_w32 Word32
w Int
16) :: Word8)
Ptr Word8 -> Word8 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word8
p Ptr Word8 -> Int -> Ptr Word8
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
3) (Word32 -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32 -> Int -> Word32
shiftr_w32 Word32
w Int
24) :: Word8)
{-# INLINE putWord32le #-}
putWord64be :: Ptr Word8 -> Word64 -> IO ()
putWord64be :: Ptr Word8 -> Word64 -> IO ()
putWord64be = if ByteOrder
byteOrder ByteOrder -> ByteOrder -> Bool
forall a. Eq a => a -> a -> Bool
== ByteOrder
BigEndian
then \Ptr Word8
p Word64
w -> Ptr Word64 -> Word64 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word8 -> Ptr Word64
forall a b. Ptr a -> Ptr b
castPtr Ptr Word8
p) Word64
w
else \Ptr Word8
p Word64
w -> do
#if WORD_SIZE_IN_BITS < 64
let a :: Word32
a = Word64 -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word64 -> Int -> Word64
shiftr_w64 Word64
w Int
32) :: Word32
b :: Word32
b = Word64 -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word64
w :: Word32
Ptr Word8 -> Word8 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr Word8
p (Word32 -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32 -> Int -> Word32
shiftr_w32 Word32
a Int
24) :: Word8)
Ptr Word8 -> Word8 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word8
p Ptr Word8 -> Int -> Ptr Word8
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
1) (Word32 -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32 -> Int -> Word32
shiftr_w32 Word32
a Int
16) :: Word8)
Ptr Word8 -> Word8 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word8
p Ptr Word8 -> Int -> Ptr Word8
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
2) (Word32 -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32 -> Int -> Word32
shiftr_w32 Word32
a Int
8) :: Word8)
Ptr Word8 -> Word8 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word8
p Ptr Word8 -> Int -> Ptr Word8
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
3) (Word32 -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32
a) :: Word8)
Ptr Word8 -> Word8 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word8
p Ptr Word8 -> Int -> Ptr Word8
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4) (Word32 -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32 -> Int -> Word32
shiftr_w32 Word32
b Int
24) :: Word8)
Ptr Word8 -> Word8 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word8
p Ptr Word8 -> Int -> Ptr Word8
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
5) (Word32 -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32 -> Int -> Word32
shiftr_w32 Word32
b Int
16) :: Word8)
Ptr Word8 -> Word8 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word8
p Ptr Word8 -> Int -> Ptr Word8
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
6) (Word32 -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32 -> Int -> Word32
shiftr_w32 Word32
b Int
8) :: Word8)
Ptr Word8 -> Word8 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word8
p Ptr Word8 -> Int -> Ptr Word8
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
7) (Word32 -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32
b) :: Word8)
#else
poke p (fromIntegral (shiftr_w64 w 56) :: Word8)
poke (p `plusPtr` 1) (fromIntegral (shiftr_w64 w 48) :: Word8)
poke (p `plusPtr` 2) (fromIntegral (shiftr_w64 w 40) :: Word8)
poke (p `plusPtr` 3) (fromIntegral (shiftr_w64 w 32) :: Word8)
poke (p `plusPtr` 4) (fromIntegral (shiftr_w64 w 24) :: Word8)
poke (p `plusPtr` 5) (fromIntegral (shiftr_w64 w 16) :: Word8)
poke (p `plusPtr` 6) (fromIntegral (shiftr_w64 w 8) :: Word8)
poke (p `plusPtr` 7) (fromIntegral (w) :: Word8)
#endif
{-# INLINE putWord64be #-}
putWord64le :: Ptr Word8 -> Word64 -> IO ()
putWord64le :: Ptr Word8 -> Word64 -> IO ()
putWord64le = if ByteOrder
byteOrder ByteOrder -> ByteOrder -> Bool
forall a. Eq a => a -> a -> Bool
== ByteOrder
LittleEndian
then \Ptr Word8
p Word64
w -> Ptr Word64 -> Word64 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word8 -> Ptr Word64
forall a b. Ptr a -> Ptr b
castPtr Ptr Word8
p) Word64
w
else \Ptr Word8
p Word64
w -> do
#if WORD_SIZE_IN_BITS < 64
let b :: Word32
b = Word64 -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word64 -> Int -> Word64
shiftr_w64 Word64
w Int
32) :: Word32
a :: Word32
a = Word64 -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word64
w :: Word32
Ptr Word8 -> Word8 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word8
p) (Word32 -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32
a) :: Word8)
Ptr Word8 -> Word8 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word8
p Ptr Word8 -> Int -> Ptr Word8
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
1) (Word32 -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32 -> Int -> Word32
shiftr_w32 Word32
a Int
8) :: Word8)
Ptr Word8 -> Word8 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word8
p Ptr Word8 -> Int -> Ptr Word8
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
2) (Word32 -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32 -> Int -> Word32
shiftr_w32 Word32
a Int
16) :: Word8)
Ptr Word8 -> Word8 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word8
p Ptr Word8 -> Int -> Ptr Word8
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
3) (Word32 -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32 -> Int -> Word32
shiftr_w32 Word32
a Int
24) :: Word8)
Ptr Word8 -> Word8 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word8
p Ptr Word8 -> Int -> Ptr Word8
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4) (Word32 -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32
b) :: Word8)
Ptr Word8 -> Word8 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word8
p Ptr Word8 -> Int -> Ptr Word8
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
5) (Word32 -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32 -> Int -> Word32
shiftr_w32 Word32
b Int
8) :: Word8)
Ptr Word8 -> Word8 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word8
p Ptr Word8 -> Int -> Ptr Word8
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
6) (Word32 -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32 -> Int -> Word32
shiftr_w32 Word32
b Int
16) :: Word8)
Ptr Word8 -> Word8 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word8
p Ptr Word8 -> Int -> Ptr Word8
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
7) (Word32 -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word32 -> Int -> Word32
shiftr_w32 Word32
b Int
24) :: Word8)
#else
poke p (fromIntegral (w) :: Word8)
poke (p `plusPtr` 1) (fromIntegral (shiftr_w64 w 8) :: Word8)
poke (p `plusPtr` 2) (fromIntegral (shiftr_w64 w 16) :: Word8)
poke (p `plusPtr` 3) (fromIntegral (shiftr_w64 w 24) :: Word8)
poke (p `plusPtr` 4) (fromIntegral (shiftr_w64 w 32) :: Word8)
poke (p `plusPtr` 5) (fromIntegral (shiftr_w64 w 40) :: Word8)
poke (p `plusPtr` 6) (fromIntegral (shiftr_w64 w 48) :: Word8)
poke (p `plusPtr` 7) (fromIntegral (shiftr_w64 w 56) :: Word8)
#endif
{-# INLINE putWord64le #-}
getWord16be :: Ptr Word8 -> IO Word16
getWord16be :: Ptr Word8 -> IO Word16
getWord16be = if ByteOrder
byteOrder ByteOrder -> ByteOrder -> Bool
forall a. Eq a => a -> a -> Bool
== ByteOrder
BigEndian
then \Ptr Word8
p -> Ptr Word16 -> IO Word16
forall a. Storable a => Ptr a -> IO a
peek (Ptr Word8 -> Ptr Word16
forall a b. Ptr a -> Ptr b
castPtr Ptr Word8
p)
else \Ptr Word8
p -> do
Word16
b0 <- Word8 -> Word16
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word8 -> Word16) -> IO Word8 -> IO Word16
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` (Ptr Word8
p Ptr Word8 -> Int -> IO Word8
forall a. Storable a => Ptr a -> Int -> IO a
`peekElemOff` Int
0)
Word16
b1 <- Word8 -> Word16
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word8 -> Word16) -> IO Word8 -> IO Word16
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` (Ptr Word8
p Ptr Word8 -> Int -> IO Word8
forall a. Storable a => Ptr a -> Int -> IO a
`peekElemOff` Int
1)
Word16 -> IO Word16
forall (m :: * -> *) a. Monad m => a -> m a
return (Word16 -> IO Word16) -> Word16 -> IO Word16
forall a b. (a -> b) -> a -> b
$! (Word16
b0 Word16 -> Int -> Word16
`shiftl_w16` Int
8) Word16 -> Word16 -> Word16
forall a. Bits a => a -> a -> a
.|.
(Word16
b1 )
{-# INLINE getWord16be #-}
getWord16le :: Ptr Word8 -> IO Word16
getWord16le :: Ptr Word8 -> IO Word16
getWord16le = if ByteOrder
byteOrder ByteOrder -> ByteOrder -> Bool
forall a. Eq a => a -> a -> Bool
== ByteOrder
LittleEndian
then \Ptr Word8
p -> Ptr Word16 -> IO Word16
forall a. Storable a => Ptr a -> IO a
peek (Ptr Word8 -> Ptr Word16
forall a b. Ptr a -> Ptr b
castPtr Ptr Word8
p)
else \Ptr Word8
p -> do
Word16
b0 <- Word8 -> Word16
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word8 -> Word16) -> IO Word8 -> IO Word16
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` (Ptr Word8
p Ptr Word8 -> Int -> IO Word8
forall a. Storable a => Ptr a -> Int -> IO a
`peekElemOff` Int
0)
Word16
b1 <- Word8 -> Word16
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word8 -> Word16) -> IO Word8 -> IO Word16
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` (Ptr Word8
p Ptr Word8 -> Int -> IO Word8
forall a. Storable a => Ptr a -> Int -> IO a
`peekElemOff` Int
1)
Word16 -> IO Word16
forall (m :: * -> *) a. Monad m => a -> m a
return (Word16 -> IO Word16) -> Word16 -> IO Word16
forall a b. (a -> b) -> a -> b
$! (Word16
b1 Word16 -> Int -> Word16
`shiftl_w16` Int
8) Word16 -> Word16 -> Word16
forall a. Bits a => a -> a -> a
.|.
(Word16
b0 )
{-# INLINE getWord16le #-}
getWord32be :: Ptr Word8 -> IO Word32
getWord32be :: Ptr Word8 -> IO Word32
getWord32be = if ByteOrder
byteOrder ByteOrder -> ByteOrder -> Bool
forall a. Eq a => a -> a -> Bool
== ByteOrder
BigEndian
then \Ptr Word8
p -> Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek (Ptr Word8 -> Ptr Word32
forall a b. Ptr a -> Ptr b
castPtr Ptr Word8
p)
else \Ptr Word8
p -> do
Word32
b0 <- Word8 -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word8 -> Word32) -> IO Word8 -> IO Word32
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` (Ptr Word8
p Ptr Word8 -> Int -> IO Word8
forall a. Storable a => Ptr a -> Int -> IO a
`peekElemOff` Int
0)
Word32
b1 <- Word8 -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word8 -> Word32) -> IO Word8 -> IO Word32
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` (Ptr Word8
p Ptr Word8 -> Int -> IO Word8
forall a. Storable a => Ptr a -> Int -> IO a
`peekElemOff` Int
1)
Word32
b2 <- Word8 -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word8 -> Word32) -> IO Word8 -> IO Word32
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` (Ptr Word8
p Ptr Word8 -> Int -> IO Word8
forall a. Storable a => Ptr a -> Int -> IO a
`peekElemOff` Int
2)
Word32
b3 <- Word8 -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word8 -> Word32) -> IO Word8 -> IO Word32
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` (Ptr Word8
p Ptr Word8 -> Int -> IO Word8
forall a. Storable a => Ptr a -> Int -> IO a
`peekElemOff` Int
3)
Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return (Word32 -> IO Word32) -> Word32 -> IO Word32
forall a b. (a -> b) -> a -> b
$! (Word32
b0 Word32 -> Int -> Word32
`shiftl_w32` Int
24) Word32 -> Word32 -> Word32
forall a. Bits a => a -> a -> a
.|.
(Word32
b1 Word32 -> Int -> Word32
`shiftl_w32` Int
16) Word32 -> Word32 -> Word32
forall a. Bits a => a -> a -> a
.|.
(Word32
b2 Word32 -> Int -> Word32
`shiftl_w32` Int
8) Word32 -> Word32 -> Word32
forall a. Bits a => a -> a -> a
.|.
(Word32
b3 )
{-# INLINE getWord32be #-}
getWord32le :: Ptr Word8 -> IO Word32
getWord32le :: Ptr Word8 -> IO Word32
getWord32le = if ByteOrder
byteOrder ByteOrder -> ByteOrder -> Bool
forall a. Eq a => a -> a -> Bool
== ByteOrder
LittleEndian
then \Ptr Word8
p -> Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek (Ptr Word8 -> Ptr Word32
forall a b. Ptr a -> Ptr b
castPtr Ptr Word8
p)
else \Ptr Word8
p -> do
Word32
b0 <- Word8 -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word8 -> Word32) -> IO Word8 -> IO Word32
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` (Ptr Word8
p Ptr Word8 -> Int -> IO Word8
forall a. Storable a => Ptr a -> Int -> IO a
`peekElemOff` Int
0)
Word32
b1 <- Word8 -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word8 -> Word32) -> IO Word8 -> IO Word32
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` (Ptr Word8
p Ptr Word8 -> Int -> IO Word8
forall a. Storable a => Ptr a -> Int -> IO a
`peekElemOff` Int
1)
Word32
b2 <- Word8 -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word8 -> Word32) -> IO Word8 -> IO Word32
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` (Ptr Word8
p Ptr Word8 -> Int -> IO Word8
forall a. Storable a => Ptr a -> Int -> IO a
`peekElemOff` Int
2)
Word32
b3 <- Word8 -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word8 -> Word32) -> IO Word8 -> IO Word32
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` (Ptr Word8
p Ptr Word8 -> Int -> IO Word8
forall a. Storable a => Ptr a -> Int -> IO a
`peekElemOff` Int
3)
Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return (Word32 -> IO Word32) -> Word32 -> IO Word32
forall a b. (a -> b) -> a -> b
$! (Word32
b3 Word32 -> Int -> Word32
`shiftl_w32` Int
24) Word32 -> Word32 -> Word32
forall a. Bits a => a -> a -> a
.|.
(Word32
b2 Word32 -> Int -> Word32
`shiftl_w32` Int
16) Word32 -> Word32 -> Word32
forall a. Bits a => a -> a -> a
.|.
(Word32
b1 Word32 -> Int -> Word32
`shiftl_w32` Int
8) Word32 -> Word32 -> Word32
forall a. Bits a => a -> a -> a
.|.
(Word32
b0 )
{-# INLINE getWord32le #-}
getWord64be :: Ptr Word8 -> IO Word64
getWord64be :: Ptr Word8 -> IO Word64
getWord64be = if ByteOrder
byteOrder ByteOrder -> ByteOrder -> Bool
forall a. Eq a => a -> a -> Bool
== ByteOrder
BigEndian
then \Ptr Word8
p -> Ptr Word64 -> IO Word64
forall a. Storable a => Ptr a -> IO a
peek (Ptr Word8 -> Ptr Word64
forall a b. Ptr a -> Ptr b
castPtr Ptr Word8
p)
else \Ptr Word8
p -> do
Word64
b0 <- Word8 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word8 -> Word64) -> IO Word8 -> IO Word64
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` (Ptr Word8
p Ptr Word8 -> Int -> IO Word8
forall a. Storable a => Ptr a -> Int -> IO a
`peekElemOff` Int
0)
Word64
b1 <- Word8 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word8 -> Word64) -> IO Word8 -> IO Word64
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` (Ptr Word8
p Ptr Word8 -> Int -> IO Word8
forall a. Storable a => Ptr a -> Int -> IO a
`peekElemOff` Int
1)
Word64
b2 <- Word8 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word8 -> Word64) -> IO Word8 -> IO Word64
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` (Ptr Word8
p Ptr Word8 -> Int -> IO Word8
forall a. Storable a => Ptr a -> Int -> IO a
`peekElemOff` Int
2)
Word64
b3 <- Word8 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word8 -> Word64) -> IO Word8 -> IO Word64
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` (Ptr Word8
p Ptr Word8 -> Int -> IO Word8
forall a. Storable a => Ptr a -> Int -> IO a
`peekElemOff` Int
3)
Word64
b4 <- Word8 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word8 -> Word64) -> IO Word8 -> IO Word64
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` (Ptr Word8
p Ptr Word8 -> Int -> IO Word8
forall a. Storable a => Ptr a -> Int -> IO a
`peekElemOff` Int
4)
Word64
b5 <- Word8 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word8 -> Word64) -> IO Word8 -> IO Word64
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` (Ptr Word8
p Ptr Word8 -> Int -> IO Word8
forall a. Storable a => Ptr a -> Int -> IO a
`peekElemOff` Int
5)
Word64
b6 <- Word8 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word8 -> Word64) -> IO Word8 -> IO Word64
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` (Ptr Word8
p Ptr Word8 -> Int -> IO Word8
forall a. Storable a => Ptr a -> Int -> IO a
`peekElemOff` Int
6)
Word64
b7 <- Word8 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word8 -> Word64) -> IO Word8 -> IO Word64
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` (Ptr Word8
p Ptr Word8 -> Int -> IO Word8
forall a. Storable a => Ptr a -> Int -> IO a
`peekElemOff` Int
7)
Word64 -> IO Word64
forall (m :: * -> *) a. Monad m => a -> m a
return (Word64 -> IO Word64) -> Word64 -> IO Word64
forall a b. (a -> b) -> a -> b
$! (Word64
b0 Word64 -> Int -> Word64
`shiftl_w64` Int
56) Word64 -> Word64 -> Word64
forall a. Bits a => a -> a -> a
.|.
(Word64
b1 Word64 -> Int -> Word64
`shiftl_w64` Int
48) Word64 -> Word64 -> Word64
forall a. Bits a => a -> a -> a
.|.
(Word64
b2 Word64 -> Int -> Word64
`shiftl_w64` Int
40) Word64 -> Word64 -> Word64
forall a. Bits a => a -> a -> a
.|.
(Word64
b3 Word64 -> Int -> Word64
`shiftl_w64` Int
32) Word64 -> Word64 -> Word64
forall a. Bits a => a -> a -> a
.|.
(Word64
b4 Word64 -> Int -> Word64
`shiftl_w64` Int
24) Word64 -> Word64 -> Word64
forall a. Bits a => a -> a -> a
.|.
(Word64
b5 Word64 -> Int -> Word64
`shiftl_w64` Int
16) Word64 -> Word64 -> Word64
forall a. Bits a => a -> a -> a
.|.
(Word64
b6 Word64 -> Int -> Word64
`shiftl_w64` Int
8) Word64 -> Word64 -> Word64
forall a. Bits a => a -> a -> a
.|.
(Word64
b7 )
{-# INLINE getWord64be #-}
getWord64le :: Ptr Word8 -> IO Word64
getWord64le :: Ptr Word8 -> IO Word64
getWord64le = if ByteOrder
byteOrder ByteOrder -> ByteOrder -> Bool
forall a. Eq a => a -> a -> Bool
== ByteOrder
LittleEndian
then \Ptr Word8
p -> Ptr Word64 -> IO Word64
forall a. Storable a => Ptr a -> IO a
peek (Ptr Word8 -> Ptr Word64
forall a b. Ptr a -> Ptr b
castPtr Ptr Word8
p)
else \Ptr Word8
p -> do
Word64
b0 <- Word8 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word8 -> Word64) -> IO Word8 -> IO Word64
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` (Ptr Word8
p Ptr Word8 -> Int -> IO Word8
forall a. Storable a => Ptr a -> Int -> IO a
`peekElemOff` Int
0)
Word64
b1 <- Word8 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word8 -> Word64) -> IO Word8 -> IO Word64
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` (Ptr Word8
p Ptr Word8 -> Int -> IO Word8
forall a. Storable a => Ptr a -> Int -> IO a
`peekElemOff` Int
1)
Word64
b2 <- Word8 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word8 -> Word64) -> IO Word8 -> IO Word64
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` (Ptr Word8
p Ptr Word8 -> Int -> IO Word8
forall a. Storable a => Ptr a -> Int -> IO a
`peekElemOff` Int
2)
Word64
b3 <- Word8 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word8 -> Word64) -> IO Word8 -> IO Word64
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` (Ptr Word8
p Ptr Word8 -> Int -> IO Word8
forall a. Storable a => Ptr a -> Int -> IO a
`peekElemOff` Int
3)
Word64
b4 <- Word8 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word8 -> Word64) -> IO Word8 -> IO Word64
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` (Ptr Word8
p Ptr Word8 -> Int -> IO Word8
forall a. Storable a => Ptr a -> Int -> IO a
`peekElemOff` Int
4)
Word64
b5 <- Word8 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word8 -> Word64) -> IO Word8 -> IO Word64
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` (Ptr Word8
p Ptr Word8 -> Int -> IO Word8
forall a. Storable a => Ptr a -> Int -> IO a
`peekElemOff` Int
5)
Word64
b6 <- Word8 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word8 -> Word64) -> IO Word8 -> IO Word64
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` (Ptr Word8
p Ptr Word8 -> Int -> IO Word8
forall a. Storable a => Ptr a -> Int -> IO a
`peekElemOff` Int
6)
Word64
b7 <- Word8 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word8 -> Word64) -> IO Word8 -> IO Word64
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` (Ptr Word8
p Ptr Word8 -> Int -> IO Word8
forall a. Storable a => Ptr a -> Int -> IO a
`peekElemOff` Int
7)
Word64 -> IO Word64
forall (m :: * -> *) a. Monad m => a -> m a
return (Word64 -> IO Word64) -> Word64 -> IO Word64
forall a b. (a -> b) -> a -> b
$! (Word64
b7 Word64 -> Int -> Word64
`shiftl_w64` Int
56) Word64 -> Word64 -> Word64
forall a. Bits a => a -> a -> a
.|.
(Word64
b6 Word64 -> Int -> Word64
`shiftl_w64` Int
48) Word64 -> Word64 -> Word64
forall a. Bits a => a -> a -> a
.|.
(Word64
b5 Word64 -> Int -> Word64
`shiftl_w64` Int
40) Word64 -> Word64 -> Word64
forall a. Bits a => a -> a -> a
.|.
(Word64
b4 Word64 -> Int -> Word64
`shiftl_w64` Int
32) Word64 -> Word64 -> Word64
forall a. Bits a => a -> a -> a
.|.
(Word64
b3 Word64 -> Int -> Word64
`shiftl_w64` Int
24) Word64 -> Word64 -> Word64
forall a. Bits a => a -> a -> a
.|.
(Word64
b2 Word64 -> Int -> Word64
`shiftl_w64` Int
16) Word64 -> Word64 -> Word64
forall a. Bits a => a -> a -> a
.|.
(Word64
b1 Word64 -> Int -> Word64
`shiftl_w64` Int
8) Word64 -> Word64 -> Word64
forall a. Bits a => a -> a -> a
.|.
(Word64
b0 )
{-# INLINE getWord64le #-}
{-# INLINE shiftr_w16 #-}
shiftr_w16 :: Word16 -> Int -> Word16
{-# INLINE shiftr_w32 #-}
shiftr_w32 :: Word32 -> Int -> Word32
{-# INLINE shiftr_w64 #-}
shiftr_w64 :: Word64 -> Int -> Word64
shiftr_w16 :: Word16 -> Int -> Word16
shiftr_w16 = Word16 -> Int -> Word16
forall a. Bits a => a -> Int -> a
shiftR
shiftr_w32 :: Word32 -> Int -> Word32
shiftr_w32 = Word32 -> Int -> Word32
forall a. Bits a => a -> Int -> a
shiftR
shiftr_w64 :: Word64 -> Int -> Word64
shiftr_w64 = Word64 -> Int -> Word64
forall a. Bits a => a -> Int -> a
shiftR
shiftl_w16 :: Word16 -> Int -> Word16
shiftl_w32 :: Word32 -> Int -> Word32
shiftl_w64 :: Word64 -> Int -> Word64
shiftl_w16 :: Word16 -> Int -> Word16
shiftl_w16 = Word16 -> Int -> Word16
forall a. Bits a => a -> Int -> a
shiftL
shiftl_w32 :: Word32 -> Int -> Word32
shiftl_w32 = Word32 -> Int -> Word32
forall a. Bits a => a -> Int -> a
shiftL
shiftl_w64 :: Word64 -> Int -> Word64
shiftl_w64 = Word64 -> Int -> Word64
forall a. Bits a => a -> Int -> a
shiftL