{-# LANGUAGE CPP, MagicHash, UnboxedTuples, Trustworthy, GeneralizedNewtypeDeriving #-}

{- |
    Module      :  SDP.Unboxed.IntAs
    Copyright   :  (c) Andrey Mulik 2020
    License     :  BSD-style
    Maintainer  :  work.a.mulik@gmail.com
    Portability :  non-portable (GHC extensions)
    
    "SDP.Unboxed.IntAs" provides additional 'Int' instances for 'Unboxed'.
-}
module SDP.Unboxed.IntAs
(
  IntAs8 (..), IntAs16 (..), IntAs32 (..), IntAs64 (..)
)
where

import Prelude ()
import SDP.SafePrelude
import SDP.Unboxed
import SDP.Index

import GHC.Base
import GHC.Exts

import Foreign.Storable

import Text.Read

#include "MachDeps.h"

default ()

--------------------------------------------------------------------------------

-- | Int value as 1 byte.
newtype IntAs8  = IntAs8  Int
  deriving ( IntAs8 -> IntAs8 -> Bool
(IntAs8 -> IntAs8 -> Bool)
-> (IntAs8 -> IntAs8 -> Bool) -> Eq IntAs8
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IntAs8 -> IntAs8 -> Bool
$c/= :: IntAs8 -> IntAs8 -> Bool
== :: IntAs8 -> IntAs8 -> Bool
$c== :: IntAs8 -> IntAs8 -> Bool
Eq, Eq IntAs8
Eq IntAs8
-> (IntAs8 -> IntAs8 -> Ordering)
-> (IntAs8 -> IntAs8 -> Bool)
-> (IntAs8 -> IntAs8 -> Bool)
-> (IntAs8 -> IntAs8 -> Bool)
-> (IntAs8 -> IntAs8 -> Bool)
-> (IntAs8 -> IntAs8 -> IntAs8)
-> (IntAs8 -> IntAs8 -> IntAs8)
-> Ord IntAs8
IntAs8 -> IntAs8 -> Bool
IntAs8 -> IntAs8 -> Ordering
IntAs8 -> IntAs8 -> IntAs8
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 :: IntAs8 -> IntAs8 -> IntAs8
$cmin :: IntAs8 -> IntAs8 -> IntAs8
max :: IntAs8 -> IntAs8 -> IntAs8
$cmax :: IntAs8 -> IntAs8 -> IntAs8
>= :: IntAs8 -> IntAs8 -> Bool
$c>= :: IntAs8 -> IntAs8 -> Bool
> :: IntAs8 -> IntAs8 -> Bool
$c> :: IntAs8 -> IntAs8 -> Bool
<= :: IntAs8 -> IntAs8 -> Bool
$c<= :: IntAs8 -> IntAs8 -> Bool
< :: IntAs8 -> IntAs8 -> Bool
$c< :: IntAs8 -> IntAs8 -> Bool
compare :: IntAs8 -> IntAs8 -> Ordering
$ccompare :: IntAs8 -> IntAs8 -> Ordering
$cp1Ord :: Eq IntAs8
Ord, Int -> IntAs8
IntAs8 -> Int
IntAs8 -> [IntAs8]
IntAs8 -> IntAs8
IntAs8 -> IntAs8 -> [IntAs8]
IntAs8 -> IntAs8 -> IntAs8 -> [IntAs8]
(IntAs8 -> IntAs8)
-> (IntAs8 -> IntAs8)
-> (Int -> IntAs8)
-> (IntAs8 -> Int)
-> (IntAs8 -> [IntAs8])
-> (IntAs8 -> IntAs8 -> [IntAs8])
-> (IntAs8 -> IntAs8 -> [IntAs8])
-> (IntAs8 -> IntAs8 -> IntAs8 -> [IntAs8])
-> Enum IntAs8
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 :: IntAs8 -> IntAs8 -> IntAs8 -> [IntAs8]
$cenumFromThenTo :: IntAs8 -> IntAs8 -> IntAs8 -> [IntAs8]
enumFromTo :: IntAs8 -> IntAs8 -> [IntAs8]
$cenumFromTo :: IntAs8 -> IntAs8 -> [IntAs8]
enumFromThen :: IntAs8 -> IntAs8 -> [IntAs8]
$cenumFromThen :: IntAs8 -> IntAs8 -> [IntAs8]
enumFrom :: IntAs8 -> [IntAs8]
$cenumFrom :: IntAs8 -> [IntAs8]
fromEnum :: IntAs8 -> Int
$cfromEnum :: IntAs8 -> Int
toEnum :: Int -> IntAs8
$ctoEnum :: Int -> IntAs8
pred :: IntAs8 -> IntAs8
$cpred :: IntAs8 -> IntAs8
succ :: IntAs8 -> IntAs8
$csucc :: IntAs8 -> IntAs8
Enum, IntAs8
IntAs8 -> IntAs8 -> Bounded IntAs8
forall a. a -> a -> Bounded a
maxBound :: IntAs8
$cmaxBound :: IntAs8
minBound :: IntAs8
$cminBound :: IntAs8
Bounded, Integer -> IntAs8
IntAs8 -> IntAs8
IntAs8 -> IntAs8 -> IntAs8
(IntAs8 -> IntAs8 -> IntAs8)
-> (IntAs8 -> IntAs8 -> IntAs8)
-> (IntAs8 -> IntAs8 -> IntAs8)
-> (IntAs8 -> IntAs8)
-> (IntAs8 -> IntAs8)
-> (IntAs8 -> IntAs8)
-> (Integer -> IntAs8)
-> Num IntAs8
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
fromInteger :: Integer -> IntAs8
$cfromInteger :: Integer -> IntAs8
signum :: IntAs8 -> IntAs8
$csignum :: IntAs8 -> IntAs8
abs :: IntAs8 -> IntAs8
$cabs :: IntAs8 -> IntAs8
negate :: IntAs8 -> IntAs8
$cnegate :: IntAs8 -> IntAs8
* :: IntAs8 -> IntAs8 -> IntAs8
$c* :: IntAs8 -> IntAs8 -> IntAs8
- :: IntAs8 -> IntAs8 -> IntAs8
$c- :: IntAs8 -> IntAs8 -> IntAs8
+ :: IntAs8 -> IntAs8 -> IntAs8
$c+ :: IntAs8 -> IntAs8 -> IntAs8
Num, Num IntAs8
Ord IntAs8
Num IntAs8 -> Ord IntAs8 -> (IntAs8 -> Rational) -> Real IntAs8
IntAs8 -> Rational
forall a. Num a -> Ord a -> (a -> Rational) -> Real a
toRational :: IntAs8 -> Rational
$ctoRational :: IntAs8 -> Rational
$cp2Real :: Ord IntAs8
$cp1Real :: Num IntAs8
Real, Enum IntAs8
Real IntAs8
Real IntAs8
-> Enum IntAs8
-> (IntAs8 -> IntAs8 -> IntAs8)
-> (IntAs8 -> IntAs8 -> IntAs8)
-> (IntAs8 -> IntAs8 -> IntAs8)
-> (IntAs8 -> IntAs8 -> IntAs8)
-> (IntAs8 -> IntAs8 -> (IntAs8, IntAs8))
-> (IntAs8 -> IntAs8 -> (IntAs8, IntAs8))
-> (IntAs8 -> Integer)
-> Integral IntAs8
IntAs8 -> Integer
IntAs8 -> IntAs8 -> (IntAs8, IntAs8)
IntAs8 -> IntAs8 -> IntAs8
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 :: IntAs8 -> Integer
$ctoInteger :: IntAs8 -> Integer
divMod :: IntAs8 -> IntAs8 -> (IntAs8, IntAs8)
$cdivMod :: IntAs8 -> IntAs8 -> (IntAs8, IntAs8)
quotRem :: IntAs8 -> IntAs8 -> (IntAs8, IntAs8)
$cquotRem :: IntAs8 -> IntAs8 -> (IntAs8, IntAs8)
mod :: IntAs8 -> IntAs8 -> IntAs8
$cmod :: IntAs8 -> IntAs8 -> IntAs8
div :: IntAs8 -> IntAs8 -> IntAs8
$cdiv :: IntAs8 -> IntAs8 -> IntAs8
rem :: IntAs8 -> IntAs8 -> IntAs8
$crem :: IntAs8 -> IntAs8 -> IntAs8
quot :: IntAs8 -> IntAs8 -> IntAs8
$cquot :: IntAs8 -> IntAs8 -> IntAs8
$cp2Integral :: Enum IntAs8
$cp1Integral :: Real IntAs8
Integral )

-- | Int value as 2 bytes.
newtype IntAs16 = IntAs16 Int
  deriving ( IntAs16 -> IntAs16 -> Bool
(IntAs16 -> IntAs16 -> Bool)
-> (IntAs16 -> IntAs16 -> Bool) -> Eq IntAs16
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IntAs16 -> IntAs16 -> Bool
$c/= :: IntAs16 -> IntAs16 -> Bool
== :: IntAs16 -> IntAs16 -> Bool
$c== :: IntAs16 -> IntAs16 -> Bool
Eq, Eq IntAs16
Eq IntAs16
-> (IntAs16 -> IntAs16 -> Ordering)
-> (IntAs16 -> IntAs16 -> Bool)
-> (IntAs16 -> IntAs16 -> Bool)
-> (IntAs16 -> IntAs16 -> Bool)
-> (IntAs16 -> IntAs16 -> Bool)
-> (IntAs16 -> IntAs16 -> IntAs16)
-> (IntAs16 -> IntAs16 -> IntAs16)
-> Ord IntAs16
IntAs16 -> IntAs16 -> Bool
IntAs16 -> IntAs16 -> Ordering
IntAs16 -> IntAs16 -> IntAs16
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 :: IntAs16 -> IntAs16 -> IntAs16
$cmin :: IntAs16 -> IntAs16 -> IntAs16
max :: IntAs16 -> IntAs16 -> IntAs16
$cmax :: IntAs16 -> IntAs16 -> IntAs16
>= :: IntAs16 -> IntAs16 -> Bool
$c>= :: IntAs16 -> IntAs16 -> Bool
> :: IntAs16 -> IntAs16 -> Bool
$c> :: IntAs16 -> IntAs16 -> Bool
<= :: IntAs16 -> IntAs16 -> Bool
$c<= :: IntAs16 -> IntAs16 -> Bool
< :: IntAs16 -> IntAs16 -> Bool
$c< :: IntAs16 -> IntAs16 -> Bool
compare :: IntAs16 -> IntAs16 -> Ordering
$ccompare :: IntAs16 -> IntAs16 -> Ordering
$cp1Ord :: Eq IntAs16
Ord, Int -> IntAs16
IntAs16 -> Int
IntAs16 -> [IntAs16]
IntAs16 -> IntAs16
IntAs16 -> IntAs16 -> [IntAs16]
IntAs16 -> IntAs16 -> IntAs16 -> [IntAs16]
(IntAs16 -> IntAs16)
-> (IntAs16 -> IntAs16)
-> (Int -> IntAs16)
-> (IntAs16 -> Int)
-> (IntAs16 -> [IntAs16])
-> (IntAs16 -> IntAs16 -> [IntAs16])
-> (IntAs16 -> IntAs16 -> [IntAs16])
-> (IntAs16 -> IntAs16 -> IntAs16 -> [IntAs16])
-> Enum IntAs16
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 :: IntAs16 -> IntAs16 -> IntAs16 -> [IntAs16]
$cenumFromThenTo :: IntAs16 -> IntAs16 -> IntAs16 -> [IntAs16]
enumFromTo :: IntAs16 -> IntAs16 -> [IntAs16]
$cenumFromTo :: IntAs16 -> IntAs16 -> [IntAs16]
enumFromThen :: IntAs16 -> IntAs16 -> [IntAs16]
$cenumFromThen :: IntAs16 -> IntAs16 -> [IntAs16]
enumFrom :: IntAs16 -> [IntAs16]
$cenumFrom :: IntAs16 -> [IntAs16]
fromEnum :: IntAs16 -> Int
$cfromEnum :: IntAs16 -> Int
toEnum :: Int -> IntAs16
$ctoEnum :: Int -> IntAs16
pred :: IntAs16 -> IntAs16
$cpred :: IntAs16 -> IntAs16
succ :: IntAs16 -> IntAs16
$csucc :: IntAs16 -> IntAs16
Enum, IntAs16
IntAs16 -> IntAs16 -> Bounded IntAs16
forall a. a -> a -> Bounded a
maxBound :: IntAs16
$cmaxBound :: IntAs16
minBound :: IntAs16
$cminBound :: IntAs16
Bounded, Integer -> IntAs16
IntAs16 -> IntAs16
IntAs16 -> IntAs16 -> IntAs16
(IntAs16 -> IntAs16 -> IntAs16)
-> (IntAs16 -> IntAs16 -> IntAs16)
-> (IntAs16 -> IntAs16 -> IntAs16)
-> (IntAs16 -> IntAs16)
-> (IntAs16 -> IntAs16)
-> (IntAs16 -> IntAs16)
-> (Integer -> IntAs16)
-> Num IntAs16
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
fromInteger :: Integer -> IntAs16
$cfromInteger :: Integer -> IntAs16
signum :: IntAs16 -> IntAs16
$csignum :: IntAs16 -> IntAs16
abs :: IntAs16 -> IntAs16
$cabs :: IntAs16 -> IntAs16
negate :: IntAs16 -> IntAs16
$cnegate :: IntAs16 -> IntAs16
* :: IntAs16 -> IntAs16 -> IntAs16
$c* :: IntAs16 -> IntAs16 -> IntAs16
- :: IntAs16 -> IntAs16 -> IntAs16
$c- :: IntAs16 -> IntAs16 -> IntAs16
+ :: IntAs16 -> IntAs16 -> IntAs16
$c+ :: IntAs16 -> IntAs16 -> IntAs16
Num, Num IntAs16
Ord IntAs16
Num IntAs16 -> Ord IntAs16 -> (IntAs16 -> Rational) -> Real IntAs16
IntAs16 -> Rational
forall a. Num a -> Ord a -> (a -> Rational) -> Real a
toRational :: IntAs16 -> Rational
$ctoRational :: IntAs16 -> Rational
$cp2Real :: Ord IntAs16
$cp1Real :: Num IntAs16
Real, Enum IntAs16
Real IntAs16
Real IntAs16
-> Enum IntAs16
-> (IntAs16 -> IntAs16 -> IntAs16)
-> (IntAs16 -> IntAs16 -> IntAs16)
-> (IntAs16 -> IntAs16 -> IntAs16)
-> (IntAs16 -> IntAs16 -> IntAs16)
-> (IntAs16 -> IntAs16 -> (IntAs16, IntAs16))
-> (IntAs16 -> IntAs16 -> (IntAs16, IntAs16))
-> (IntAs16 -> Integer)
-> Integral IntAs16
IntAs16 -> Integer
IntAs16 -> IntAs16 -> (IntAs16, IntAs16)
IntAs16 -> IntAs16 -> IntAs16
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 :: IntAs16 -> Integer
$ctoInteger :: IntAs16 -> Integer
divMod :: IntAs16 -> IntAs16 -> (IntAs16, IntAs16)
$cdivMod :: IntAs16 -> IntAs16 -> (IntAs16, IntAs16)
quotRem :: IntAs16 -> IntAs16 -> (IntAs16, IntAs16)
$cquotRem :: IntAs16 -> IntAs16 -> (IntAs16, IntAs16)
mod :: IntAs16 -> IntAs16 -> IntAs16
$cmod :: IntAs16 -> IntAs16 -> IntAs16
div :: IntAs16 -> IntAs16 -> IntAs16
$cdiv :: IntAs16 -> IntAs16 -> IntAs16
rem :: IntAs16 -> IntAs16 -> IntAs16
$crem :: IntAs16 -> IntAs16 -> IntAs16
quot :: IntAs16 -> IntAs16 -> IntAs16
$cquot :: IntAs16 -> IntAs16 -> IntAs16
$cp2Integral :: Enum IntAs16
$cp1Integral :: Real IntAs16
Integral )

-- | Int value as 4 bytes.
newtype IntAs32 = IntAs32 Int
  deriving ( IntAs32 -> IntAs32 -> Bool
(IntAs32 -> IntAs32 -> Bool)
-> (IntAs32 -> IntAs32 -> Bool) -> Eq IntAs32
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IntAs32 -> IntAs32 -> Bool
$c/= :: IntAs32 -> IntAs32 -> Bool
== :: IntAs32 -> IntAs32 -> Bool
$c== :: IntAs32 -> IntAs32 -> Bool
Eq, Eq IntAs32
Eq IntAs32
-> (IntAs32 -> IntAs32 -> Ordering)
-> (IntAs32 -> IntAs32 -> Bool)
-> (IntAs32 -> IntAs32 -> Bool)
-> (IntAs32 -> IntAs32 -> Bool)
-> (IntAs32 -> IntAs32 -> Bool)
-> (IntAs32 -> IntAs32 -> IntAs32)
-> (IntAs32 -> IntAs32 -> IntAs32)
-> Ord IntAs32
IntAs32 -> IntAs32 -> Bool
IntAs32 -> IntAs32 -> Ordering
IntAs32 -> IntAs32 -> IntAs32
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 :: IntAs32 -> IntAs32 -> IntAs32
$cmin :: IntAs32 -> IntAs32 -> IntAs32
max :: IntAs32 -> IntAs32 -> IntAs32
$cmax :: IntAs32 -> IntAs32 -> IntAs32
>= :: IntAs32 -> IntAs32 -> Bool
$c>= :: IntAs32 -> IntAs32 -> Bool
> :: IntAs32 -> IntAs32 -> Bool
$c> :: IntAs32 -> IntAs32 -> Bool
<= :: IntAs32 -> IntAs32 -> Bool
$c<= :: IntAs32 -> IntAs32 -> Bool
< :: IntAs32 -> IntAs32 -> Bool
$c< :: IntAs32 -> IntAs32 -> Bool
compare :: IntAs32 -> IntAs32 -> Ordering
$ccompare :: IntAs32 -> IntAs32 -> Ordering
$cp1Ord :: Eq IntAs32
Ord, Int -> IntAs32
IntAs32 -> Int
IntAs32 -> [IntAs32]
IntAs32 -> IntAs32
IntAs32 -> IntAs32 -> [IntAs32]
IntAs32 -> IntAs32 -> IntAs32 -> [IntAs32]
(IntAs32 -> IntAs32)
-> (IntAs32 -> IntAs32)
-> (Int -> IntAs32)
-> (IntAs32 -> Int)
-> (IntAs32 -> [IntAs32])
-> (IntAs32 -> IntAs32 -> [IntAs32])
-> (IntAs32 -> IntAs32 -> [IntAs32])
-> (IntAs32 -> IntAs32 -> IntAs32 -> [IntAs32])
-> Enum IntAs32
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 :: IntAs32 -> IntAs32 -> IntAs32 -> [IntAs32]
$cenumFromThenTo :: IntAs32 -> IntAs32 -> IntAs32 -> [IntAs32]
enumFromTo :: IntAs32 -> IntAs32 -> [IntAs32]
$cenumFromTo :: IntAs32 -> IntAs32 -> [IntAs32]
enumFromThen :: IntAs32 -> IntAs32 -> [IntAs32]
$cenumFromThen :: IntAs32 -> IntAs32 -> [IntAs32]
enumFrom :: IntAs32 -> [IntAs32]
$cenumFrom :: IntAs32 -> [IntAs32]
fromEnum :: IntAs32 -> Int
$cfromEnum :: IntAs32 -> Int
toEnum :: Int -> IntAs32
$ctoEnum :: Int -> IntAs32
pred :: IntAs32 -> IntAs32
$cpred :: IntAs32 -> IntAs32
succ :: IntAs32 -> IntAs32
$csucc :: IntAs32 -> IntAs32
Enum, IntAs32
IntAs32 -> IntAs32 -> Bounded IntAs32
forall a. a -> a -> Bounded a
maxBound :: IntAs32
$cmaxBound :: IntAs32
minBound :: IntAs32
$cminBound :: IntAs32
Bounded, Integer -> IntAs32
IntAs32 -> IntAs32
IntAs32 -> IntAs32 -> IntAs32
(IntAs32 -> IntAs32 -> IntAs32)
-> (IntAs32 -> IntAs32 -> IntAs32)
-> (IntAs32 -> IntAs32 -> IntAs32)
-> (IntAs32 -> IntAs32)
-> (IntAs32 -> IntAs32)
-> (IntAs32 -> IntAs32)
-> (Integer -> IntAs32)
-> Num IntAs32
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
fromInteger :: Integer -> IntAs32
$cfromInteger :: Integer -> IntAs32
signum :: IntAs32 -> IntAs32
$csignum :: IntAs32 -> IntAs32
abs :: IntAs32 -> IntAs32
$cabs :: IntAs32 -> IntAs32
negate :: IntAs32 -> IntAs32
$cnegate :: IntAs32 -> IntAs32
* :: IntAs32 -> IntAs32 -> IntAs32
$c* :: IntAs32 -> IntAs32 -> IntAs32
- :: IntAs32 -> IntAs32 -> IntAs32
$c- :: IntAs32 -> IntAs32 -> IntAs32
+ :: IntAs32 -> IntAs32 -> IntAs32
$c+ :: IntAs32 -> IntAs32 -> IntAs32
Num, Num IntAs32
Ord IntAs32
Num IntAs32 -> Ord IntAs32 -> (IntAs32 -> Rational) -> Real IntAs32
IntAs32 -> Rational
forall a. Num a -> Ord a -> (a -> Rational) -> Real a
toRational :: IntAs32 -> Rational
$ctoRational :: IntAs32 -> Rational
$cp2Real :: Ord IntAs32
$cp1Real :: Num IntAs32
Real, Enum IntAs32
Real IntAs32
Real IntAs32
-> Enum IntAs32
-> (IntAs32 -> IntAs32 -> IntAs32)
-> (IntAs32 -> IntAs32 -> IntAs32)
-> (IntAs32 -> IntAs32 -> IntAs32)
-> (IntAs32 -> IntAs32 -> IntAs32)
-> (IntAs32 -> IntAs32 -> (IntAs32, IntAs32))
-> (IntAs32 -> IntAs32 -> (IntAs32, IntAs32))
-> (IntAs32 -> Integer)
-> Integral IntAs32
IntAs32 -> Integer
IntAs32 -> IntAs32 -> (IntAs32, IntAs32)
IntAs32 -> IntAs32 -> IntAs32
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 :: IntAs32 -> Integer
$ctoInteger :: IntAs32 -> Integer
divMod :: IntAs32 -> IntAs32 -> (IntAs32, IntAs32)
$cdivMod :: IntAs32 -> IntAs32 -> (IntAs32, IntAs32)
quotRem :: IntAs32 -> IntAs32 -> (IntAs32, IntAs32)
$cquotRem :: IntAs32 -> IntAs32 -> (IntAs32, IntAs32)
mod :: IntAs32 -> IntAs32 -> IntAs32
$cmod :: IntAs32 -> IntAs32 -> IntAs32
div :: IntAs32 -> IntAs32 -> IntAs32
$cdiv :: IntAs32 -> IntAs32 -> IntAs32
rem :: IntAs32 -> IntAs32 -> IntAs32
$crem :: IntAs32 -> IntAs32 -> IntAs32
quot :: IntAs32 -> IntAs32 -> IntAs32
$cquot :: IntAs32 -> IntAs32 -> IntAs32
$cp2Integral :: Enum IntAs32
$cp1Integral :: Real IntAs32
Integral )

-- | Int value as 8 bytes.
newtype IntAs64 = IntAs64 Int
  deriving ( IntAs64 -> IntAs64 -> Bool
(IntAs64 -> IntAs64 -> Bool)
-> (IntAs64 -> IntAs64 -> Bool) -> Eq IntAs64
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IntAs64 -> IntAs64 -> Bool
$c/= :: IntAs64 -> IntAs64 -> Bool
== :: IntAs64 -> IntAs64 -> Bool
$c== :: IntAs64 -> IntAs64 -> Bool
Eq, Eq IntAs64
Eq IntAs64
-> (IntAs64 -> IntAs64 -> Ordering)
-> (IntAs64 -> IntAs64 -> Bool)
-> (IntAs64 -> IntAs64 -> Bool)
-> (IntAs64 -> IntAs64 -> Bool)
-> (IntAs64 -> IntAs64 -> Bool)
-> (IntAs64 -> IntAs64 -> IntAs64)
-> (IntAs64 -> IntAs64 -> IntAs64)
-> Ord IntAs64
IntAs64 -> IntAs64 -> Bool
IntAs64 -> IntAs64 -> Ordering
IntAs64 -> IntAs64 -> IntAs64
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 :: IntAs64 -> IntAs64 -> IntAs64
$cmin :: IntAs64 -> IntAs64 -> IntAs64
max :: IntAs64 -> IntAs64 -> IntAs64
$cmax :: IntAs64 -> IntAs64 -> IntAs64
>= :: IntAs64 -> IntAs64 -> Bool
$c>= :: IntAs64 -> IntAs64 -> Bool
> :: IntAs64 -> IntAs64 -> Bool
$c> :: IntAs64 -> IntAs64 -> Bool
<= :: IntAs64 -> IntAs64 -> Bool
$c<= :: IntAs64 -> IntAs64 -> Bool
< :: IntAs64 -> IntAs64 -> Bool
$c< :: IntAs64 -> IntAs64 -> Bool
compare :: IntAs64 -> IntAs64 -> Ordering
$ccompare :: IntAs64 -> IntAs64 -> Ordering
$cp1Ord :: Eq IntAs64
Ord, Int -> IntAs64
IntAs64 -> Int
IntAs64 -> [IntAs64]
IntAs64 -> IntAs64
IntAs64 -> IntAs64 -> [IntAs64]
IntAs64 -> IntAs64 -> IntAs64 -> [IntAs64]
(IntAs64 -> IntAs64)
-> (IntAs64 -> IntAs64)
-> (Int -> IntAs64)
-> (IntAs64 -> Int)
-> (IntAs64 -> [IntAs64])
-> (IntAs64 -> IntAs64 -> [IntAs64])
-> (IntAs64 -> IntAs64 -> [IntAs64])
-> (IntAs64 -> IntAs64 -> IntAs64 -> [IntAs64])
-> Enum IntAs64
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 :: IntAs64 -> IntAs64 -> IntAs64 -> [IntAs64]
$cenumFromThenTo :: IntAs64 -> IntAs64 -> IntAs64 -> [IntAs64]
enumFromTo :: IntAs64 -> IntAs64 -> [IntAs64]
$cenumFromTo :: IntAs64 -> IntAs64 -> [IntAs64]
enumFromThen :: IntAs64 -> IntAs64 -> [IntAs64]
$cenumFromThen :: IntAs64 -> IntAs64 -> [IntAs64]
enumFrom :: IntAs64 -> [IntAs64]
$cenumFrom :: IntAs64 -> [IntAs64]
fromEnum :: IntAs64 -> Int
$cfromEnum :: IntAs64 -> Int
toEnum :: Int -> IntAs64
$ctoEnum :: Int -> IntAs64
pred :: IntAs64 -> IntAs64
$cpred :: IntAs64 -> IntAs64
succ :: IntAs64 -> IntAs64
$csucc :: IntAs64 -> IntAs64
Enum, IntAs64
IntAs64 -> IntAs64 -> Bounded IntAs64
forall a. a -> a -> Bounded a
maxBound :: IntAs64
$cmaxBound :: IntAs64
minBound :: IntAs64
$cminBound :: IntAs64
Bounded, Integer -> IntAs64
IntAs64 -> IntAs64
IntAs64 -> IntAs64 -> IntAs64
(IntAs64 -> IntAs64 -> IntAs64)
-> (IntAs64 -> IntAs64 -> IntAs64)
-> (IntAs64 -> IntAs64 -> IntAs64)
-> (IntAs64 -> IntAs64)
-> (IntAs64 -> IntAs64)
-> (IntAs64 -> IntAs64)
-> (Integer -> IntAs64)
-> Num IntAs64
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
fromInteger :: Integer -> IntAs64
$cfromInteger :: Integer -> IntAs64
signum :: IntAs64 -> IntAs64
$csignum :: IntAs64 -> IntAs64
abs :: IntAs64 -> IntAs64
$cabs :: IntAs64 -> IntAs64
negate :: IntAs64 -> IntAs64
$cnegate :: IntAs64 -> IntAs64
* :: IntAs64 -> IntAs64 -> IntAs64
$c* :: IntAs64 -> IntAs64 -> IntAs64
- :: IntAs64 -> IntAs64 -> IntAs64
$c- :: IntAs64 -> IntAs64 -> IntAs64
+ :: IntAs64 -> IntAs64 -> IntAs64
$c+ :: IntAs64 -> IntAs64 -> IntAs64
Num, Num IntAs64
Ord IntAs64
Num IntAs64 -> Ord IntAs64 -> (IntAs64 -> Rational) -> Real IntAs64
IntAs64 -> Rational
forall a. Num a -> Ord a -> (a -> Rational) -> Real a
toRational :: IntAs64 -> Rational
$ctoRational :: IntAs64 -> Rational
$cp2Real :: Ord IntAs64
$cp1Real :: Num IntAs64
Real, Enum IntAs64
Real IntAs64
Real IntAs64
-> Enum IntAs64
-> (IntAs64 -> IntAs64 -> IntAs64)
-> (IntAs64 -> IntAs64 -> IntAs64)
-> (IntAs64 -> IntAs64 -> IntAs64)
-> (IntAs64 -> IntAs64 -> IntAs64)
-> (IntAs64 -> IntAs64 -> (IntAs64, IntAs64))
-> (IntAs64 -> IntAs64 -> (IntAs64, IntAs64))
-> (IntAs64 -> Integer)
-> Integral IntAs64
IntAs64 -> Integer
IntAs64 -> IntAs64 -> (IntAs64, IntAs64)
IntAs64 -> IntAs64 -> IntAs64
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 :: IntAs64 -> Integer
$ctoInteger :: IntAs64 -> Integer
divMod :: IntAs64 -> IntAs64 -> (IntAs64, IntAs64)
$cdivMod :: IntAs64 -> IntAs64 -> (IntAs64, IntAs64)
quotRem :: IntAs64 -> IntAs64 -> (IntAs64, IntAs64)
$cquotRem :: IntAs64 -> IntAs64 -> (IntAs64, IntAs64)
mod :: IntAs64 -> IntAs64 -> IntAs64
$cmod :: IntAs64 -> IntAs64 -> IntAs64
div :: IntAs64 -> IntAs64 -> IntAs64
$cdiv :: IntAs64 -> IntAs64 -> IntAs64
rem :: IntAs64 -> IntAs64 -> IntAs64
$crem :: IntAs64 -> IntAs64 -> IntAs64
quot :: IntAs64 -> IntAs64 -> IntAs64
$cquot :: IntAs64 -> IntAs64 -> IntAs64
$cp2Integral :: Enum IntAs64
$cp1Integral :: Real IntAs64
Integral )

--------------------------------------------------------------------------------

instance Shape IntAs8
instance Shape IntAs16
instance Shape IntAs32
instance Shape IntAs64

instance Index IntAs8  where offset :: (IntAs8, IntAs8) -> IntAs8 -> Int
offset = (IntAs8, IntAs8) -> IntAs8 -> Int
forall i. (Index i, Integral i) => (i, i) -> i -> Int
offsetIntegral
instance Index IntAs16 where offset :: (IntAs16, IntAs16) -> IntAs16 -> Int
offset = (IntAs16, IntAs16) -> IntAs16 -> Int
forall i. (Index i, Integral i) => (i, i) -> i -> Int
offsetIntegral
instance Index IntAs32 where offset :: (IntAs32, IntAs32) -> IntAs32 -> Int
offset = (IntAs32, IntAs32) -> IntAs32 -> Int
forall i. (Index i, Integral i) => (i, i) -> i -> Int
offsetIntegral
instance Index IntAs64 where offset :: (IntAs64, IntAs64) -> IntAs64 -> Int
offset = (IntAs64, IntAs64) -> IntAs64 -> Int
forall i. (Index i, Integral i) => (i, i) -> i -> Int
offsetIntegral

instance Show IntAs8  where show :: IntAs8 -> String
show (IntAs8  Int
x) = Int -> String
forall a. Show a => a -> String
show Int
x
instance Show IntAs16 where show :: IntAs16 -> String
show (IntAs16 Int
x) = Int -> String
forall a. Show a => a -> String
show Int
x
instance Show IntAs32 where show :: IntAs32 -> String
show (IntAs32 Int
x) = Int -> String
forall a. Show a => a -> String
show Int
x
instance Show IntAs64 where show :: IntAs64 -> String
show (IntAs64 Int
x) = Int -> String
forall a. Show a => a -> String
show Int
x

instance Read IntAs8  where readPrec :: ReadPrec IntAs8
readPrec = Int -> IntAs8
IntAs8  (Int -> IntAs8) -> ReadPrec Int -> ReadPrec IntAs8
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadPrec Int
forall a. Read a => ReadPrec a
readPrec
instance Read IntAs16 where readPrec :: ReadPrec IntAs16
readPrec = Int -> IntAs16
IntAs16 (Int -> IntAs16) -> ReadPrec Int -> ReadPrec IntAs16
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadPrec Int
forall a. Read a => ReadPrec a
readPrec
instance Read IntAs32 where readPrec :: ReadPrec IntAs32
readPrec = Int -> IntAs32
IntAs32 (Int -> IntAs32) -> ReadPrec Int -> ReadPrec IntAs32
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadPrec Int
forall a. Read a => ReadPrec a
readPrec
instance Read IntAs64 where readPrec :: ReadPrec IntAs64
readPrec = Int -> IntAs64
IntAs64 (Int -> IntAs64) -> ReadPrec Int -> ReadPrec IntAs64
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ReadPrec Int
forall a. Read a => ReadPrec a
readPrec

instance Unboxed IntAs8
  where
    {-# INLINE sizeof #-}
    sizeof :: IntAs8 -> Int -> Int
sizeof IntAs8
_ Int
n = Int -> Int -> Int
forall a. Ord a => a -> a -> a
max Int
0 Int
n
    
    {-# INLINE (!#) #-}
    ByteArray#
bytes#  !# :: ByteArray# -> Int# -> IntAs8
!#  Int#
i# = Int -> IntAs8
IntAs8 (Int# -> Int
I# (ByteArray# -> Int# -> Int#
indexInt8Array# ByteArray#
bytes# Int#
i#))
    
    {-# INLINE (!>#) #-}
    MutableByteArray# s
mbytes# !># :: MutableByteArray# s -> Int# -> State# s -> (# State# s, IntAs8 #)
!># Int#
i# = \ State# s
s1# -> case MutableByteArray# s -> Int# -> State# s -> (# State# s, Int# #)
forall d.
MutableByteArray# d -> Int# -> State# d -> (# State# d, Int# #)
readInt8Array# MutableByteArray# s
mbytes# Int#
i# State# s
s1# of
      (# State# s
s2#, Int#
e# #) -> (# State# s
s2#, Int -> IntAs8
IntAs8 (Int# -> Int
I# Int#
e#) #)
    
    writeByteArray# :: MutableByteArray# s -> Int# -> IntAs8 -> State# s -> State# s
writeByteArray# MutableByteArray# s
mbytes# Int#
n# (IntAs8 (I# Int#
e#)) = MutableByteArray# s -> Int# -> Int# -> State# s -> State# s
forall d.
MutableByteArray# d -> Int# -> Int# -> State# d -> State# d
writeInt8Array# MutableByteArray# s
mbytes# Int#
n# Int#
e#
    
    newUnboxed :: IntAs8 -> Int# -> State# s -> (# State# s, MutableByteArray# s #)
newUnboxed IntAs8
e Int#
n# = \ State# s
s1# -> case Int# -> State# s -> (# State# s, MutableByteArray# s #)
forall d. Int# -> State# d -> (# State# d, MutableByteArray# d #)
newByteArray# (IntAs8 -> Int# -> Int#
forall e. Unboxed e => e -> Int# -> Int#
sizeof# IntAs8
e Int#
n#) State# s
s1# of
      (# State# s
s2#, MutableByteArray# s
mbytes# #) -> case MutableByteArray# s -> Int# -> IntAs8 -> State# s -> State# s
forall e s.
Unboxed e =>
MutableByteArray# s -> Int# -> e -> State# s -> State# s
fillByteArray# MutableByteArray# s
mbytes# Int#
n# (IntAs8
0 :: IntAs8) State# s
s2# of
        State# s
s3# -> (# State# s
s3#, MutableByteArray# s
mbytes# #)

instance Unboxed IntAs16
  where
    {-# INLINE sizeof #-}
    sizeof :: IntAs16 -> Int -> Int
sizeof IntAs16
_ Int
n = Int -> Int -> Int
forall a. Ord a => a -> a -> a
max Int
0 Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
2
    
    {-# INLINE (!#) #-}
    ByteArray#
bytes#  !# :: ByteArray# -> Int# -> IntAs16
!#  Int#
i# = Int -> IntAs16
IntAs16 (Int# -> Int
I# (ByteArray# -> Int# -> Int#
indexInt16Array# ByteArray#
bytes# Int#
i#))
    
    {-# INLINE (!>#) #-}
    MutableByteArray# s
mbytes# !># :: MutableByteArray# s -> Int# -> State# s -> (# State# s, IntAs16 #)
!># Int#
i# = \ State# s
s1# -> case MutableByteArray# s -> Int# -> State# s -> (# State# s, Int# #)
forall d.
MutableByteArray# d -> Int# -> State# d -> (# State# d, Int# #)
readInt16Array# MutableByteArray# s
mbytes# Int#
i# State# s
s1# of
      (# State# s
s2#, Int#
e# #) -> (# State# s
s2#, Int -> IntAs16
IntAs16 (Int# -> Int
I# Int#
e#) #)
    
    writeByteArray# :: MutableByteArray# s -> Int# -> IntAs16 -> State# s -> State# s
writeByteArray# MutableByteArray# s
mbytes# Int#
n# (IntAs16 (I# Int#
e#)) = MutableByteArray# s -> Int# -> Int# -> State# s -> State# s
forall d.
MutableByteArray# d -> Int# -> Int# -> State# d -> State# d
writeInt16Array# MutableByteArray# s
mbytes# Int#
n# Int#
e#
    
    newUnboxed :: IntAs16 -> Int# -> State# s -> (# State# s, MutableByteArray# s #)
newUnboxed IntAs16
e Int#
n# = \ State# s
s1# -> case Int# -> State# s -> (# State# s, MutableByteArray# s #)
forall d. Int# -> State# d -> (# State# d, MutableByteArray# d #)
newByteArray# (IntAs16 -> Int# -> Int#
forall e. Unboxed e => e -> Int# -> Int#
sizeof# IntAs16
e Int#
n#) State# s
s1# of
      (# State# s
s2#, MutableByteArray# s
mbytes# #) -> case MutableByteArray# s -> Int# -> IntAs16 -> State# s -> State# s
forall e s.
Unboxed e =>
MutableByteArray# s -> Int# -> e -> State# s -> State# s
fillByteArray# MutableByteArray# s
mbytes# Int#
n# (IntAs16
0 :: IntAs16) State# s
s2# of
        State# s
s3# -> (# State# s
s3#, MutableByteArray# s
mbytes# #)

instance Unboxed IntAs32
  where
    {-# INLINE sizeof #-}
    sizeof :: IntAs32 -> Int -> Int
sizeof IntAs32
_ Int
n = Int -> Int -> Int
forall a. Ord a => a -> a -> a
max Int
0 Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
4
    
    {-# INLINE (!#) #-}
    ByteArray#
bytes#  !# :: ByteArray# -> Int# -> IntAs32
!#  Int#
i# = Int -> IntAs32
IntAs32 (Int# -> Int
I# (ByteArray# -> Int# -> Int#
indexInt32Array# ByteArray#
bytes# Int#
i#))
    
    {-# INLINE (!>#) #-}
    MutableByteArray# s
mbytes# !># :: MutableByteArray# s -> Int# -> State# s -> (# State# s, IntAs32 #)
!># Int#
i# = \ State# s
s1# -> case MutableByteArray# s -> Int# -> State# s -> (# State# s, Int# #)
forall d.
MutableByteArray# d -> Int# -> State# d -> (# State# d, Int# #)
readInt32Array# MutableByteArray# s
mbytes# Int#
i# State# s
s1# of
      (# State# s
s2#, Int#
e# #) -> (# State# s
s2#, Int -> IntAs32
IntAs32 (Int# -> Int
I# Int#
e#) #)
    
    writeByteArray# :: MutableByteArray# s -> Int# -> IntAs32 -> State# s -> State# s
writeByteArray# MutableByteArray# s
mbytes# Int#
n# (IntAs32 (I# Int#
e#)) = MutableByteArray# s -> Int# -> Int# -> State# s -> State# s
forall d.
MutableByteArray# d -> Int# -> Int# -> State# d -> State# d
writeInt32Array# MutableByteArray# s
mbytes# Int#
n# Int#
e#
    
    newUnboxed :: IntAs32 -> Int# -> State# s -> (# State# s, MutableByteArray# s #)
newUnboxed IntAs32
e Int#
n# = \ State# s
s1# -> case Int# -> State# s -> (# State# s, MutableByteArray# s #)
forall d. Int# -> State# d -> (# State# d, MutableByteArray# d #)
newByteArray# (IntAs32 -> Int# -> Int#
forall e. Unboxed e => e -> Int# -> Int#
sizeof# IntAs32
e Int#
n#) State# s
s1# of
      (# State# s
s2#, MutableByteArray# s
mbytes# #) -> case MutableByteArray# s -> Int# -> IntAs32 -> State# s -> State# s
forall e s.
Unboxed e =>
MutableByteArray# s -> Int# -> e -> State# s -> State# s
fillByteArray# MutableByteArray# s
mbytes# Int#
n# (IntAs32
0 :: IntAs32) State# s
s2# of
        State# s
s3# -> (# State# s
s3#, MutableByteArray# s
mbytes# #)

instance Unboxed IntAs64
  where
    {-# INLINE sizeof #-}
    sizeof :: IntAs64 -> Int -> Int
sizeof IntAs64
_ Int
n = Int -> Int -> Int
forall a. Ord a => a -> a -> a
max Int
0 Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
8
    
    {-# INLINE (!#) #-}
    ByteArray#
bytes#  !# :: ByteArray# -> Int# -> IntAs64
!#  Int#
i# = Int -> IntAs64
IntAs64 (Int# -> Int
I# (ByteArray# -> Int# -> Int#
indexInt64Array# ByteArray#
bytes# Int#
i#))
    
    {-# INLINE (!>#) #-}
    MutableByteArray# s
mbytes# !># :: MutableByteArray# s -> Int# -> State# s -> (# State# s, IntAs64 #)
!># Int#
i# = \ State# s
s1# -> case MutableByteArray# s -> Int# -> State# s -> (# State# s, Int# #)
forall d.
MutableByteArray# d -> Int# -> State# d -> (# State# d, Int# #)
readInt64Array# MutableByteArray# s
mbytes# Int#
i# State# s
s1# of
      (# State# s
s2#, Int#
e# #) -> (# State# s
s2#, Int -> IntAs64
IntAs64 (Int# -> Int
I# Int#
e#) #)
    
    writeByteArray# :: MutableByteArray# s -> Int# -> IntAs64 -> State# s -> State# s
writeByteArray# MutableByteArray# s
mbytes# Int#
n# (IntAs64 (I# Int#
e#)) = MutableByteArray# s -> Int# -> Int# -> State# s -> State# s
forall d.
MutableByteArray# d -> Int# -> Int# -> State# d -> State# d
writeInt64Array# MutableByteArray# s
mbytes# Int#
n# Int#
e#
    
    newUnboxed :: IntAs64 -> Int# -> State# s -> (# State# s, MutableByteArray# s #)
newUnboxed IntAs64
e Int#
n# = \ State# s
s1# -> case Int# -> State# s -> (# State# s, MutableByteArray# s #)
forall d. Int# -> State# d -> (# State# d, MutableByteArray# d #)
newByteArray# (IntAs64 -> Int# -> Int#
forall e. Unboxed e => e -> Int# -> Int#
sizeof# IntAs64
e Int#
n#) State# s
s1# of
      (# State# s
s2#, MutableByteArray# s
mbytes# #) -> case MutableByteArray# s -> Int# -> IntAs64 -> State# s -> State# s
forall e s.
Unboxed e =>
MutableByteArray# s -> Int# -> e -> State# s -> State# s
fillByteArray# MutableByteArray# s
mbytes# Int#
n# (IntAs64
0 :: IntAs64) State# s
s2# of
        State# s
s3# -> (# State# s
s3#, MutableByteArray# s
mbytes# #)

--------------------------------------------------------------------------------

instance Storable IntAs8
  where
    sizeOf :: IntAs8 -> Int
sizeOf    IntAs8
_ = SIZEOF_INT8
    alignment :: IntAs8 -> Int
alignment IntAs8
_ = ALIGNMENT_INT8
    
    peekElemOff :: Ptr IntAs8 -> Int -> IO IntAs8
peekElemOff (Ptr Addr#
p#) (I# Int#
i#) = (State# RealWorld -> (# State# RealWorld, IntAs8 #)) -> IO IntAs8
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, IntAs8 #)) -> IO IntAs8)
-> (State# RealWorld -> (# State# RealWorld, IntAs8 #))
-> IO IntAs8
forall a b. (a -> b) -> a -> b
$
      \ State# RealWorld
s1# -> case Addr# -> Int# -> State# RealWorld -> (# State# RealWorld, Int# #)
forall d. Addr# -> Int# -> State# d -> (# State# d, Int# #)
readInt8OffAddr# Addr#
p# Int#
i# State# RealWorld
s1# of
        (# State# RealWorld
s2#, Int#
x #) -> (# State# RealWorld
s2#, Int -> IntAs8
IntAs8 (Int# -> Int
I# Int#
x) #)
    
    pokeElemOff :: Ptr IntAs8 -> Int -> IntAs8 -> IO ()
pokeElemOff (Ptr Addr#
p#) (I# Int#
i#) (IntAs8 (I# Int#
x)) = (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, () #)) -> IO ())
-> (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a b. (a -> b) -> a -> b
$
      \ State# RealWorld
s1# -> case Addr# -> Int# -> Int# -> State# RealWorld -> State# RealWorld
forall d. Addr# -> Int# -> Int# -> State# d -> State# d
writeInt8OffAddr# Addr#
p# Int#
i# Int#
x State# RealWorld
s1# of State# RealWorld
s2 -> (# State# RealWorld
s2, () #)

instance Storable IntAs16
  where
    sizeOf :: IntAs16 -> Int
sizeOf    IntAs16
_ = SIZEOF_INT16
    alignment :: IntAs16 -> Int
alignment IntAs16
_ = ALIGNMENT_INT16
    
    peekElemOff :: Ptr IntAs16 -> Int -> IO IntAs16
peekElemOff (Ptr Addr#
p#) (I# Int#
i#) = (State# RealWorld -> (# State# RealWorld, IntAs16 #)) -> IO IntAs16
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, IntAs16 #))
 -> IO IntAs16)
-> (State# RealWorld -> (# State# RealWorld, IntAs16 #))
-> IO IntAs16
forall a b. (a -> b) -> a -> b
$
      \ State# RealWorld
s1# -> case Addr# -> Int# -> State# RealWorld -> (# State# RealWorld, Int# #)
forall d. Addr# -> Int# -> State# d -> (# State# d, Int# #)
readInt16OffAddr# Addr#
p# Int#
i# State# RealWorld
s1# of
        (# State# RealWorld
s2, Int#
x #) -> (# State# RealWorld
s2, Int -> IntAs16
IntAs16 (Int# -> Int
I# Int#
x) #)
    
    pokeElemOff :: Ptr IntAs16 -> Int -> IntAs16 -> IO ()
pokeElemOff (Ptr Addr#
p#) (I# Int#
i#) (IntAs16 (I# Int#
x)) = (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, () #)) -> IO ())
-> (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a b. (a -> b) -> a -> b
$
      \ State# RealWorld
s1# -> case Addr# -> Int# -> Int# -> State# RealWorld -> State# RealWorld
forall d. Addr# -> Int# -> Int# -> State# d -> State# d
writeInt16OffAddr# Addr#
p# Int#
i# Int#
x State# RealWorld
s1# of State# RealWorld
s2 -> (# State# RealWorld
s2, () #)

instance Storable IntAs32
  where
    sizeOf :: IntAs32 -> Int
sizeOf    IntAs32
_ = SIZEOF_INT32
    alignment :: IntAs32 -> Int
alignment IntAs32
_ = ALIGNMENT_INT32
    
    peekElemOff :: Ptr IntAs32 -> Int -> IO IntAs32
peekElemOff (Ptr Addr#
p#) (I# Int#
i#) = (State# RealWorld -> (# State# RealWorld, IntAs32 #)) -> IO IntAs32
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, IntAs32 #))
 -> IO IntAs32)
-> (State# RealWorld -> (# State# RealWorld, IntAs32 #))
-> IO IntAs32
forall a b. (a -> b) -> a -> b
$
      \ State# RealWorld
s1# -> case Addr# -> Int# -> State# RealWorld -> (# State# RealWorld, Int# #)
forall d. Addr# -> Int# -> State# d -> (# State# d, Int# #)
readInt32OffAddr# Addr#
p# Int#
i# State# RealWorld
s1# of
        (# State# RealWorld
s2, Int#
x #) -> (# State# RealWorld
s2, Int -> IntAs32
IntAs32 (Int# -> Int
I# Int#
x) #)
    
    pokeElemOff :: Ptr IntAs32 -> Int -> IntAs32 -> IO ()
pokeElemOff (Ptr Addr#
p#) (I# Int#
i#) (IntAs32 (I# Int#
x)) = (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, () #)) -> IO ())
-> (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a b. (a -> b) -> a -> b
$
      \ State# RealWorld
s1# -> case Addr# -> Int# -> Int# -> State# RealWorld -> State# RealWorld
forall d. Addr# -> Int# -> Int# -> State# d -> State# d
writeInt32OffAddr# Addr#
p# Int#
i# Int#
x State# RealWorld
s1# of State# RealWorld
s2 -> (# State# RealWorld
s2, () #)

instance Storable IntAs64
  where
    sizeOf :: IntAs64 -> Int
sizeOf    IntAs64
_ = SIZEOF_INT64
    alignment :: IntAs64 -> Int
alignment IntAs64
_ = ALIGNMENT_INT64
    
    peekElemOff :: Ptr IntAs64 -> Int -> IO IntAs64
peekElemOff (Ptr Addr#
p#) (I# Int#
i#) = (State# RealWorld -> (# State# RealWorld, IntAs64 #)) -> IO IntAs64
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, IntAs64 #))
 -> IO IntAs64)
-> (State# RealWorld -> (# State# RealWorld, IntAs64 #))
-> IO IntAs64
forall a b. (a -> b) -> a -> b
$
      \ State# RealWorld
s1# -> case Addr# -> Int# -> State# RealWorld -> (# State# RealWorld, Int# #)
forall d. Addr# -> Int# -> State# d -> (# State# d, Int# #)
readInt64OffAddr# Addr#
p# Int#
i# State# RealWorld
s1# of
        (# State# RealWorld
s2, Int#
x #) -> (# State# RealWorld
s2, Int -> IntAs64
IntAs64 (Int# -> Int
I# Int#
x) #)
    
    pokeElemOff :: Ptr IntAs64 -> Int -> IntAs64 -> IO ()
pokeElemOff (Ptr Addr#
p#) (I# Int#
i#) (IntAs64 (I# Int#
x)) = (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, () #)) -> IO ())
-> (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a b. (a -> b) -> a -> b
$
      \ State# RealWorld
s1# -> case Addr# -> Int# -> Int# -> State# RealWorld -> State# RealWorld
forall d. Addr# -> Int# -> Int# -> State# d -> State# d
writeInt64OffAddr# Addr#
p# Int#
i# Int#
x State# RealWorld
s1# of State# RealWorld
s2 -> (# State# RealWorld
s2, () #)