{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE NoImplicitPrelude, MagicHash, UnboxedTuples #-}
{-# OPTIONS_HADDOCK not-home #-}

-----------------------------------------------------------------------------
-- |
-- Module      :  GHC.Storable
-- Copyright   :  (c) The FFI task force, 2000-2002
-- License     :  see libraries/base/LICENSE
--
-- Maintainer  :  ffi@haskell.org
-- Stability   :  internal
-- Portability :  non-portable (GHC Extensions)
--
-- Helper functions for "Foreign.Storable"
--
-----------------------------------------------------------------------------

module GHC.Storable
        ( readWideCharOffPtr
        , readIntOffPtr
        , readWordOffPtr
        , readPtrOffPtr
        , readFunPtrOffPtr
        , readFloatOffPtr
        , readDoubleOffPtr
        , readStablePtrOffPtr
        , readInt8OffPtr
        , readInt16OffPtr
        , readInt32OffPtr
        , readInt64OffPtr
        , readWord8OffPtr
        , readWord16OffPtr
        , readWord32OffPtr
        , readWord64OffPtr
        , writeWideCharOffPtr
        , writeIntOffPtr
        , writeWordOffPtr
        , writePtrOffPtr
        , writeFunPtrOffPtr
        , writeFloatOffPtr
        , writeDoubleOffPtr
        , writeStablePtrOffPtr
        , writeInt8OffPtr
        , writeInt16OffPtr
        , writeInt32OffPtr
        , writeInt64OffPtr
        , writeWord8OffPtr
        , writeWord16OffPtr
        , writeWord32OffPtr
        , writeWord64OffPtr
        ) where

import GHC.Stable ( StablePtr(..) )
import GHC.Int
import GHC.Word
import GHC.Ptr
import GHC.Base

readWideCharOffPtr  :: Ptr Char          -> Int -> IO Char
readIntOffPtr       :: Ptr Int           -> Int -> IO Int
readWordOffPtr      :: Ptr Word          -> Int -> IO Word
readPtrOffPtr       :: Ptr (Ptr a)       -> Int -> IO (Ptr a)
readFunPtrOffPtr    :: Ptr (FunPtr a)    -> Int -> IO (FunPtr a)
readFloatOffPtr     :: Ptr Float         -> Int -> IO Float
readDoubleOffPtr    :: Ptr Double        -> Int -> IO Double
readStablePtrOffPtr :: Ptr (StablePtr a) -> Int -> IO (StablePtr a)
readInt8OffPtr      :: Ptr Int8          -> Int -> IO Int8
readInt16OffPtr     :: Ptr Int16         -> Int -> IO Int16
readInt32OffPtr     :: Ptr Int32         -> Int -> IO Int32
readInt64OffPtr     :: Ptr Int64         -> Int -> IO Int64
readWord8OffPtr     :: Ptr Word8         -> Int -> IO Word8
readWord16OffPtr    :: Ptr Word16        -> Int -> IO Word16
readWord32OffPtr    :: Ptr Word32        -> Int -> IO Word32
readWord64OffPtr    :: Ptr Word64        -> Int -> IO Word64

readWideCharOffPtr :: Ptr Char -> Int -> IO Char
readWideCharOffPtr (Ptr Addr#
a) (I# Int#
i)
  = (State# RealWorld -> (# State# RealWorld, Char #)) -> IO Char
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Char #)) -> IO Char)
-> (State# RealWorld -> (# State# RealWorld, Char #)) -> IO Char
forall a b. (a -> b) -> a -> b
$ \State# RealWorld
s -> case Addr# -> Int# -> State# RealWorld -> (# State# RealWorld, Char# #)
forall d. Addr# -> Int# -> State# d -> (# State# d, Char# #)
readWideCharOffAddr# Addr#
a Int#
i State# RealWorld
s  of (# State# RealWorld
s2, Char#
x #) -> (# State# RealWorld
s2, Char# -> Char
C# Char#
x #)
readIntOffPtr :: Ptr Int -> Int -> IO Int
readIntOffPtr (Ptr Addr#
a) (I# Int#
i)
  = (State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int)
-> (State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int
forall a b. (a -> b) -> a -> b
$ \State# RealWorld
s -> case Addr# -> Int# -> State# RealWorld -> (# State# RealWorld, Int# #)
forall d. Addr# -> Int# -> State# d -> (# State# d, Int# #)
readIntOffAddr# Addr#
a Int#
i State# RealWorld
s       of (# State# RealWorld
s2, Int#
x #) -> (# State# RealWorld
s2, Int# -> Int
I# Int#
x #)
readWordOffPtr :: Ptr Word -> Int -> IO Word
readWordOffPtr (Ptr Addr#
a) (I# Int#
i)
  = (State# RealWorld -> (# State# RealWorld, Word #)) -> IO Word
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Word #)) -> IO Word)
-> (State# RealWorld -> (# State# RealWorld, Word #)) -> IO Word
forall a b. (a -> b) -> a -> b
$ \State# RealWorld
s -> case Addr# -> Int# -> State# RealWorld -> (# State# RealWorld, Word# #)
forall d. Addr# -> Int# -> State# d -> (# State# d, Word# #)
readWordOffAddr# Addr#
a Int#
i State# RealWorld
s      of (# State# RealWorld
s2, Word#
x #) -> (# State# RealWorld
s2, Word# -> Word
W# Word#
x #)
readPtrOffPtr :: forall a. Ptr (Ptr a) -> Int -> IO (Ptr a)
readPtrOffPtr (Ptr Addr#
a) (I# Int#
i)
  = (State# RealWorld -> (# State# RealWorld, Ptr a #)) -> IO (Ptr a)
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Ptr a #)) -> IO (Ptr a))
-> (State# RealWorld -> (# State# RealWorld, Ptr a #))
-> IO (Ptr a)
forall a b. (a -> b) -> a -> b
$ \State# RealWorld
s -> case Addr# -> Int# -> State# RealWorld -> (# State# RealWorld, Addr# #)
forall d. Addr# -> Int# -> State# d -> (# State# d, Addr# #)
readAddrOffAddr# Addr#
a Int#
i State# RealWorld
s      of (# State# RealWorld
s2, Addr#
x #) -> (# State# RealWorld
s2, Addr# -> Ptr a
forall a. Addr# -> Ptr a
Ptr Addr#
x #)
readFunPtrOffPtr :: forall a. Ptr (FunPtr a) -> Int -> IO (FunPtr a)
readFunPtrOffPtr (Ptr Addr#
a) (I# Int#
i)
  = (State# RealWorld -> (# State# RealWorld, FunPtr a #))
-> IO (FunPtr a)
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, FunPtr a #))
 -> IO (FunPtr a))
-> (State# RealWorld -> (# State# RealWorld, FunPtr a #))
-> IO (FunPtr a)
forall a b. (a -> b) -> a -> b
$ \State# RealWorld
s -> case Addr# -> Int# -> State# RealWorld -> (# State# RealWorld, Addr# #)
forall d. Addr# -> Int# -> State# d -> (# State# d, Addr# #)
readAddrOffAddr# Addr#
a Int#
i State# RealWorld
s      of (# State# RealWorld
s2, Addr#
x #) -> (# State# RealWorld
s2, Addr# -> FunPtr a
forall a. Addr# -> FunPtr a
FunPtr Addr#
x #)
readFloatOffPtr :: Ptr Float -> Int -> IO Float
readFloatOffPtr (Ptr Addr#
a) (I# Int#
i)
  = (State# RealWorld -> (# State# RealWorld, Float #)) -> IO Float
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Float #)) -> IO Float)
-> (State# RealWorld -> (# State# RealWorld, Float #)) -> IO Float
forall a b. (a -> b) -> a -> b
$ \State# RealWorld
s -> case Addr# -> Int# -> State# RealWorld -> (# State# RealWorld, Float# #)
forall d. Addr# -> Int# -> State# d -> (# State# d, Float# #)
readFloatOffAddr# Addr#
a Int#
i State# RealWorld
s     of (# State# RealWorld
s2, Float#
x #) -> (# State# RealWorld
s2, Float# -> Float
F# Float#
x #)
readDoubleOffPtr :: Ptr Double -> Int -> IO Double
readDoubleOffPtr (Ptr Addr#
a) (I# Int#
i)
  = (State# RealWorld -> (# State# RealWorld, Double #)) -> IO Double
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Double #)) -> IO Double)
-> (State# RealWorld -> (# State# RealWorld, Double #))
-> IO Double
forall a b. (a -> b) -> a -> b
$ \State# RealWorld
s -> case Addr#
-> Int# -> State# RealWorld -> (# State# RealWorld, Double# #)
forall d. Addr# -> Int# -> State# d -> (# State# d, Double# #)
readDoubleOffAddr# Addr#
a Int#
i State# RealWorld
s    of (# State# RealWorld
s2, Double#
x #) -> (# State# RealWorld
s2, Double# -> Double
D# Double#
x #)
readStablePtrOffPtr :: forall a. Ptr (StablePtr a) -> Int -> IO (StablePtr a)
readStablePtrOffPtr (Ptr Addr#
a) (I# Int#
i)
  = (State# RealWorld -> (# State# RealWorld, StablePtr a #))
-> IO (StablePtr a)
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, StablePtr a #))
 -> IO (StablePtr a))
-> (State# RealWorld -> (# State# RealWorld, StablePtr a #))
-> IO (StablePtr a)
forall a b. (a -> b) -> a -> b
$ \State# RealWorld
s -> case Addr#
-> Int# -> State# RealWorld -> (# State# RealWorld, StablePtr# a #)
forall d a.
Addr# -> Int# -> State# d -> (# State# d, StablePtr# a #)
readStablePtrOffAddr# Addr#
a Int#
i State# RealWorld
s of (# State# RealWorld
s2, StablePtr# a
x #) -> (# State# RealWorld
s2, StablePtr# a -> StablePtr a
forall a. StablePtr# a -> StablePtr a
StablePtr StablePtr# a
x #)
readInt8OffPtr :: Ptr Int8 -> Int -> IO Int8
readInt8OffPtr (Ptr Addr#
a) (I# Int#
i)
  = (State# RealWorld -> (# State# RealWorld, Int8 #)) -> IO Int8
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Int8 #)) -> IO Int8)
-> (State# RealWorld -> (# State# RealWorld, Int8 #)) -> IO Int8
forall a b. (a -> b) -> a -> b
$ \State# RealWorld
s -> case Addr# -> Int# -> State# RealWorld -> (# State# RealWorld, Int8# #)
forall d. Addr# -> Int# -> State# d -> (# State# d, Int8# #)
readInt8OffAddr# Addr#
a Int#
i State# RealWorld
s      of (# State# RealWorld
s2, Int8#
x #) -> (# State# RealWorld
s2, Int8# -> Int8
I8# Int8#
x #)
readWord8OffPtr :: Ptr Word8 -> Int -> IO Word8
readWord8OffPtr (Ptr Addr#
a) (I# Int#
i)
  = (State# RealWorld -> (# State# RealWorld, Word8 #)) -> IO Word8
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Word8 #)) -> IO Word8)
-> (State# RealWorld -> (# State# RealWorld, Word8 #)) -> IO Word8
forall a b. (a -> b) -> a -> b
$ \State# RealWorld
s -> case Addr# -> Int# -> State# RealWorld -> (# State# RealWorld, Word8# #)
forall d. Addr# -> Int# -> State# d -> (# State# d, Word8# #)
readWord8OffAddr# Addr#
a Int#
i State# RealWorld
s     of (# State# RealWorld
s2, Word8#
x #) -> (# State# RealWorld
s2, Word8# -> Word8
W8# Word8#
x #)
readInt16OffPtr :: Ptr Int16 -> Int -> IO Int16
readInt16OffPtr (Ptr Addr#
a) (I# Int#
i)
  = (State# RealWorld -> (# State# RealWorld, Int16 #)) -> IO Int16
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Int16 #)) -> IO Int16)
-> (State# RealWorld -> (# State# RealWorld, Int16 #)) -> IO Int16
forall a b. (a -> b) -> a -> b
$ \State# RealWorld
s -> case Addr# -> Int# -> State# RealWorld -> (# State# RealWorld, Int16# #)
forall d. Addr# -> Int# -> State# d -> (# State# d, Int16# #)
readInt16OffAddr# Addr#
a Int#
i State# RealWorld
s     of (# State# RealWorld
s2, Int16#
x #) -> (# State# RealWorld
s2, Int16# -> Int16
I16# Int16#
x #)
readWord16OffPtr :: Ptr Word16 -> Int -> IO Word16
readWord16OffPtr (Ptr Addr#
a) (I# Int#
i)
  = (State# RealWorld -> (# State# RealWorld, Word16 #)) -> IO Word16
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Word16 #)) -> IO Word16)
-> (State# RealWorld -> (# State# RealWorld, Word16 #))
-> IO Word16
forall a b. (a -> b) -> a -> b
$ \State# RealWorld
s -> case Addr#
-> Int# -> State# RealWorld -> (# State# RealWorld, Word16# #)
forall d. Addr# -> Int# -> State# d -> (# State# d, Word16# #)
readWord16OffAddr# Addr#
a Int#
i State# RealWorld
s    of (# State# RealWorld
s2, Word16#
x #) -> (# State# RealWorld
s2, Word16# -> Word16
W16# Word16#
x #)
readInt32OffPtr :: Ptr Int32 -> Int -> IO Int32
readInt32OffPtr (Ptr Addr#
a) (I# Int#
i)
  = (State# RealWorld -> (# State# RealWorld, Int32 #)) -> IO Int32
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Int32 #)) -> IO Int32)
-> (State# RealWorld -> (# State# RealWorld, Int32 #)) -> IO Int32
forall a b. (a -> b) -> a -> b
$ \State# RealWorld
s -> case Addr# -> Int# -> State# RealWorld -> (# State# RealWorld, Int32# #)
forall d. Addr# -> Int# -> State# d -> (# State# d, Int32# #)
readInt32OffAddr# Addr#
a Int#
i State# RealWorld
s     of (# State# RealWorld
s2, Int32#
x #) -> (# State# RealWorld
s2, Int32# -> Int32
I32# Int32#
x #)
readWord32OffPtr :: Ptr Word32 -> Int -> IO Word32
readWord32OffPtr (Ptr Addr#
a) (I# Int#
i)
  = (State# RealWorld -> (# State# RealWorld, Word32 #)) -> IO Word32
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Word32 #)) -> IO Word32)
-> (State# RealWorld -> (# State# RealWorld, Word32 #))
-> IO Word32
forall a b. (a -> b) -> a -> b
$ \State# RealWorld
s -> case Addr#
-> Int# -> State# RealWorld -> (# State# RealWorld, Word32# #)
forall d. Addr# -> Int# -> State# d -> (# State# d, Word32# #)
readWord32OffAddr# Addr#
a Int#
i State# RealWorld
s    of (# State# RealWorld
s2, Word32#
x #) -> (# State# RealWorld
s2, Word32# -> Word32
W32# Word32#
x #)
readInt64OffPtr :: Ptr Int64 -> Int -> IO Int64
readInt64OffPtr (Ptr Addr#
a) (I# Int#
i)
  = (State# RealWorld -> (# State# RealWorld, Int64 #)) -> IO Int64
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Int64 #)) -> IO Int64)
-> (State# RealWorld -> (# State# RealWorld, Int64 #)) -> IO Int64
forall a b. (a -> b) -> a -> b
$ \State# RealWorld
s -> case Addr# -> Int# -> State# RealWorld -> (# State# RealWorld, Int64# #)
forall d. Addr# -> Int# -> State# d -> (# State# d, Int64# #)
readInt64OffAddr# Addr#
a Int#
i State# RealWorld
s     of (# State# RealWorld
s2, Int64#
x #) -> (# State# RealWorld
s2, Int64# -> Int64
I64# Int64#
x #)
readWord64OffPtr :: Ptr Word64 -> Int -> IO Word64
readWord64OffPtr (Ptr Addr#
a) (I# Int#
i)
  = (State# RealWorld -> (# State# RealWorld, Word64 #)) -> IO Word64
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Word64 #)) -> IO Word64)
-> (State# RealWorld -> (# State# RealWorld, Word64 #))
-> IO Word64
forall a b. (a -> b) -> a -> b
$ \State# RealWorld
s -> case Addr#
-> Int# -> State# RealWorld -> (# State# RealWorld, Word64# #)
forall d. Addr# -> Int# -> State# d -> (# State# d, Word64# #)
readWord64OffAddr# Addr#
a Int#
i State# RealWorld
s    of (# State# RealWorld
s2, Word64#
x #) -> (# State# RealWorld
s2, Word64# -> Word64
W64# Word64#
x #)

writeWideCharOffPtr  :: Ptr Char          -> Int -> Char        -> IO ()
writeIntOffPtr       :: Ptr Int           -> Int -> Int         -> IO ()
writeWordOffPtr      :: Ptr Word          -> Int -> Word        -> IO ()
writePtrOffPtr       :: Ptr (Ptr a)       -> Int -> Ptr a       -> IO ()
writeFunPtrOffPtr    :: Ptr (FunPtr a)    -> Int -> FunPtr a    -> IO ()
writeFloatOffPtr     :: Ptr Float         -> Int -> Float       -> IO ()
writeDoubleOffPtr    :: Ptr Double        -> Int -> Double      -> IO ()
writeStablePtrOffPtr :: Ptr (StablePtr a) -> Int -> StablePtr a -> IO ()
writeInt8OffPtr      :: Ptr Int8          -> Int -> Int8        -> IO ()
writeInt16OffPtr     :: Ptr Int16         -> Int -> Int16       -> IO ()
writeInt32OffPtr     :: Ptr Int32         -> Int -> Int32       -> IO ()
writeInt64OffPtr     :: Ptr Int64         -> Int -> Int64       -> IO ()
writeWord8OffPtr     :: Ptr Word8         -> Int -> Word8       -> IO ()
writeWord16OffPtr    :: Ptr Word16        -> Int -> Word16      -> IO ()
writeWord32OffPtr    :: Ptr Word32        -> Int -> Word32      -> IO ()
writeWord64OffPtr    :: Ptr Word64        -> Int -> Word64      -> IO ()

writeWideCharOffPtr :: Ptr Char -> Int -> Char -> IO ()
writeWideCharOffPtr (Ptr Addr#
a) (I# Int#
i) (C# Char#
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
s -> case Addr# -> Int# -> Char# -> State# RealWorld -> State# RealWorld
forall d. Addr# -> Int# -> Char# -> State# d -> State# d
writeWideCharOffAddr# Addr#
a Int#
i Char#
x State# RealWorld
s  of State# RealWorld
s2 -> (# State# RealWorld
s2, () #)
writeIntOffPtr :: Ptr Int -> Int -> Int -> IO ()
writeIntOffPtr (Ptr Addr#
a) (I# Int#
i) (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
s -> case Addr# -> Int# -> Int# -> State# RealWorld -> State# RealWorld
forall d. Addr# -> Int# -> Int# -> State# d -> State# d
writeIntOffAddr# Addr#
a Int#
i Int#
x State# RealWorld
s       of State# RealWorld
s2 -> (# State# RealWorld
s2, () #)
writeWordOffPtr :: Ptr Word -> Int -> Word -> IO ()
writeWordOffPtr (Ptr Addr#
a) (I# Int#
i) (W# Word#
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
s -> case Addr# -> Int# -> Word# -> State# RealWorld -> State# RealWorld
forall d. Addr# -> Int# -> Word# -> State# d -> State# d
writeWordOffAddr# Addr#
a Int#
i Word#
x State# RealWorld
s      of State# RealWorld
s2 -> (# State# RealWorld
s2, () #)
writePtrOffPtr :: forall a. Ptr (Ptr a) -> Int -> Ptr a -> IO ()
writePtrOffPtr (Ptr Addr#
a) (I# Int#
i) (Ptr Addr#
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
s -> case Addr# -> Int# -> Addr# -> State# RealWorld -> State# RealWorld
forall d. Addr# -> Int# -> Addr# -> State# d -> State# d
writeAddrOffAddr# Addr#
a Int#
i Addr#
x State# RealWorld
s      of State# RealWorld
s2 -> (# State# RealWorld
s2, () #)
writeFunPtrOffPtr :: forall a. Ptr (FunPtr a) -> Int -> FunPtr a -> IO ()
writeFunPtrOffPtr (Ptr Addr#
a) (I# Int#
i) (FunPtr Addr#
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
s -> case Addr# -> Int# -> Addr# -> State# RealWorld -> State# RealWorld
forall d. Addr# -> Int# -> Addr# -> State# d -> State# d
writeAddrOffAddr# Addr#
a Int#
i Addr#
x State# RealWorld
s      of State# RealWorld
s2 -> (# State# RealWorld
s2, () #)
writeFloatOffPtr :: Ptr Float -> Int -> Float -> IO ()
writeFloatOffPtr (Ptr Addr#
a) (I# Int#
i) (F# Float#
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
s -> case Addr# -> Int# -> Float# -> State# RealWorld -> State# RealWorld
forall d. Addr# -> Int# -> Float# -> State# d -> State# d
writeFloatOffAddr# Addr#
a Int#
i Float#
x State# RealWorld
s     of State# RealWorld
s2 -> (# State# RealWorld
s2, () #)
writeDoubleOffPtr :: Ptr Double -> Int -> Double -> IO ()
writeDoubleOffPtr (Ptr Addr#
a) (I# Int#
i) (D# Double#
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
s -> case Addr# -> Int# -> Double# -> State# RealWorld -> State# RealWorld
forall d. Addr# -> Int# -> Double# -> State# d -> State# d
writeDoubleOffAddr# Addr#
a Int#
i Double#
x State# RealWorld
s    of State# RealWorld
s2 -> (# State# RealWorld
s2, () #)
writeStablePtrOffPtr :: forall a. Ptr (StablePtr a) -> Int -> StablePtr a -> IO ()
writeStablePtrOffPtr (Ptr Addr#
a) (I# Int#
i) (StablePtr StablePtr# a
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
s -> case Addr#
-> Int# -> StablePtr# a -> State# RealWorld -> State# RealWorld
forall a d. Addr# -> Int# -> StablePtr# a -> State# d -> State# d
writeStablePtrOffAddr# Addr#
a Int#
i StablePtr# a
x State# RealWorld
s of State# RealWorld
s2 -> (# State# RealWorld
s2 , () #)
writeInt8OffPtr :: Ptr Int8 -> Int -> Int8 -> IO ()
writeInt8OffPtr (Ptr Addr#
a) (I# Int#
i) (I8# Int8#
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
s -> case Addr# -> Int# -> Int8# -> State# RealWorld -> State# RealWorld
forall d. Addr# -> Int# -> Int8# -> State# d -> State# d
writeInt8OffAddr# Addr#
a Int#
i Int8#
x State# RealWorld
s      of State# RealWorld
s2 -> (# State# RealWorld
s2, () #)
writeWord8OffPtr :: Ptr Word8 -> Int -> Word8 -> IO ()
writeWord8OffPtr (Ptr Addr#
a) (I# Int#
i) (W8# Word8#
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
s -> case Addr# -> Int# -> Word8# -> State# RealWorld -> State# RealWorld
forall d. Addr# -> Int# -> Word8# -> State# d -> State# d
writeWord8OffAddr# Addr#
a Int#
i Word8#
x State# RealWorld
s     of State# RealWorld
s2 -> (# State# RealWorld
s2, () #)
writeInt16OffPtr :: Ptr Int16 -> Int -> Int16 -> IO ()
writeInt16OffPtr (Ptr Addr#
a) (I# Int#
i) (I16# Int16#
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
s -> case Addr# -> Int# -> Int16# -> State# RealWorld -> State# RealWorld
forall d. Addr# -> Int# -> Int16# -> State# d -> State# d
writeInt16OffAddr# Addr#
a Int#
i Int16#
x State# RealWorld
s     of State# RealWorld
s2 -> (# State# RealWorld
s2, () #)
writeWord16OffPtr :: Ptr Word16 -> Int -> Word16 -> IO ()
writeWord16OffPtr (Ptr Addr#
a) (I# Int#
i) (W16# Word16#
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
s -> case Addr# -> Int# -> Word16# -> State# RealWorld -> State# RealWorld
forall d. Addr# -> Int# -> Word16# -> State# d -> State# d
writeWord16OffAddr# Addr#
a Int#
i Word16#
x State# RealWorld
s    of State# RealWorld
s2 -> (# State# RealWorld
s2, () #)
writeInt32OffPtr :: Ptr Int32 -> Int -> Int32 -> IO ()
writeInt32OffPtr (Ptr Addr#
a) (I# Int#
i) (I32# Int32#
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
s -> case Addr# -> Int# -> Int32# -> State# RealWorld -> State# RealWorld
forall d. Addr# -> Int# -> Int32# -> State# d -> State# d
writeInt32OffAddr# Addr#
a Int#
i Int32#
x State# RealWorld
s     of State# RealWorld
s2 -> (# State# RealWorld
s2, () #)
writeWord32OffPtr :: Ptr Word32 -> Int -> Word32 -> IO ()
writeWord32OffPtr (Ptr Addr#
a) (I# Int#
i) (W32# Word32#
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
s -> case Addr# -> Int# -> Word32# -> State# RealWorld -> State# RealWorld
forall d. Addr# -> Int# -> Word32# -> State# d -> State# d
writeWord32OffAddr# Addr#
a Int#
i Word32#
x State# RealWorld
s    of State# RealWorld
s2 -> (# State# RealWorld
s2, () #)
writeInt64OffPtr :: Ptr Int64 -> Int -> Int64 -> IO ()
writeInt64OffPtr (Ptr Addr#
a) (I# Int#
i) (I64# Int64#
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
s -> case Addr# -> Int# -> Int64# -> State# RealWorld -> State# RealWorld
forall d. Addr# -> Int# -> Int64# -> State# d -> State# d
writeInt64OffAddr# Addr#
a Int#
i Int64#
x State# RealWorld
s     of State# RealWorld
s2 -> (# State# RealWorld
s2, () #)
writeWord64OffPtr :: Ptr Word64 -> Int -> Word64 -> IO ()
writeWord64OffPtr (Ptr Addr#
a) (I# Int#
i) (W64# Word64#
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
s -> case Addr# -> Int# -> Word64# -> State# RealWorld -> State# RealWorld
forall d. Addr# -> Int# -> Word64# -> State# d -> State# d
writeWord64OffAddr# Addr#
a Int#
i Word64#
x State# RealWorld
s    of State# RealWorld
s2 -> (# State# RealWorld
s2, () #)