{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UnboxedTuples #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE NoFieldSelectors #-}
{-# LANGUAGE NoImplicitPrelude #-}

-- | Atomic operations.
--
--     IMPORTANT: If you are not an expert in concurrent lockless programming, you should not be using any functions in this file. You should be protecting your data structures with full mutexes instead.
--
--     /__Seriously, here be dragons!__/
--
--     You can find out a little more about lockless programming and the subtle issues that can arise here: [https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/dxtecharts\/lockless-programming](https://learn.microsoft.com/en-us/windows/win32/dxtecharts/lockless-programming)
--
--     There\'s also lots of good information here:
--
--     * [https:\/\/www.1024cores.net\/home\/lock-free-algorithms](https://www.1024cores.net/home/lock-free-algorithms)
--
--     * [https:\/\/preshing.com\/](https://preshing.com/)
--
--     These operations may or may not actually be implemented using processor specific atomic operations. When possible they are implemented as true processor specific atomic operations. When that is not possible the are implemented using locks that /do/ use the available atomic operations.
--
--     All of the atomic operations that modify memory are full memory barriers. An atomic spinlock.
--
--     The atomic locks are efficient spinlocks using CPU instructions, but are vulnerable to starvation and can spin forever if a thread holding a lock has been terminated. For this reason you should minimize the code executed inside an atomic lock and never do expensive things like API or system calls while holding them.
--
--     They are also vulnerable to starvation if the thread holding the lock is lower priority than other threads and doesn\'t get scheduled. In general you should use mutexes instead, since they have better performance and contention behavior.
--
--     The atomic locks are not safe to lock recursively.
--
--     Porting Note: The spin lock functions and type are required and can not be emulated because they are used in the atomic emulation code.
module SDL3.Sys.Bindgen.Atomic (
  SDL3.Sys.Bindgen.Atomic.SDL_SpinLock (..),
  SDL3.Sys.Bindgen.Atomic.SDL_AtomicInt (..),
  SDL3.Sys.Bindgen.Atomic.SDL_AtomicU32 (..),
)
where

import Prelude (Bounded, Enum, Eq, Int, Integral, Num, Ord, Read, Real, Show, pure, (<*>), type (~))

import HsBindgen.Runtime.HasCField qualified as HasCField
import HsBindgen.Runtime.Marshal qualified as Marshal
import HsBindgen.Runtime.Struct qualified as Struct
import HsBindgen.Runtime.Support qualified as BG
import HsBindgen.Runtime.Support.CompatHasField qualified as BG.CompatHasField
import SDL3.Sys.Bindgen.Stdinc qualified

-- | [C declaration]: @SDL_SpinLock@, defined at @SDL3\/SDL_atomic.h 82:13@
newtype SDL_SpinLock = SDL_SpinLock
  { SDL_SpinLock -> CInt
unwrap :: BG.CInt
  }
  deriving stock ((forall x. SDL_SpinLock -> Rep SDL_SpinLock x)
-> (forall x. Rep SDL_SpinLock x -> SDL_SpinLock)
-> Generic SDL_SpinLock
forall x. Rep SDL_SpinLock x -> SDL_SpinLock
forall x. SDL_SpinLock -> Rep SDL_SpinLock x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. SDL_SpinLock -> Rep SDL_SpinLock x
from :: forall x. SDL_SpinLock -> Rep SDL_SpinLock x
$cto :: forall x. Rep SDL_SpinLock x -> SDL_SpinLock
to :: forall x. Rep SDL_SpinLock x -> SDL_SpinLock
BG.Generic, SDL_SpinLock -> SDL_SpinLock -> Bool
(SDL_SpinLock -> SDL_SpinLock -> Bool)
-> (SDL_SpinLock -> SDL_SpinLock -> Bool) -> Eq SDL_SpinLock
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SDL_SpinLock -> SDL_SpinLock -> Bool
== :: SDL_SpinLock -> SDL_SpinLock -> Bool
$c/= :: SDL_SpinLock -> SDL_SpinLock -> Bool
/= :: SDL_SpinLock -> SDL_SpinLock -> Bool
Eq, Eq SDL_SpinLock
Eq SDL_SpinLock =>
(SDL_SpinLock -> SDL_SpinLock -> Ordering)
-> (SDL_SpinLock -> SDL_SpinLock -> Bool)
-> (SDL_SpinLock -> SDL_SpinLock -> Bool)
-> (SDL_SpinLock -> SDL_SpinLock -> Bool)
-> (SDL_SpinLock -> SDL_SpinLock -> Bool)
-> (SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock)
-> (SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock)
-> Ord SDL_SpinLock
SDL_SpinLock -> SDL_SpinLock -> Bool
SDL_SpinLock -> SDL_SpinLock -> Ordering
SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock
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
$ccompare :: SDL_SpinLock -> SDL_SpinLock -> Ordering
compare :: SDL_SpinLock -> SDL_SpinLock -> Ordering
$c< :: SDL_SpinLock -> SDL_SpinLock -> Bool
< :: SDL_SpinLock -> SDL_SpinLock -> Bool
$c<= :: SDL_SpinLock -> SDL_SpinLock -> Bool
<= :: SDL_SpinLock -> SDL_SpinLock -> Bool
$c> :: SDL_SpinLock -> SDL_SpinLock -> Bool
> :: SDL_SpinLock -> SDL_SpinLock -> Bool
$c>= :: SDL_SpinLock -> SDL_SpinLock -> Bool
>= :: SDL_SpinLock -> SDL_SpinLock -> Bool
$cmax :: SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock
max :: SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock
$cmin :: SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock
min :: SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock
Ord, ReadPrec [SDL_SpinLock]
ReadPrec SDL_SpinLock
Int -> ReadS SDL_SpinLock
ReadS [SDL_SpinLock]
(Int -> ReadS SDL_SpinLock)
-> ReadS [SDL_SpinLock]
-> ReadPrec SDL_SpinLock
-> ReadPrec [SDL_SpinLock]
-> Read SDL_SpinLock
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS SDL_SpinLock
readsPrec :: Int -> ReadS SDL_SpinLock
$creadList :: ReadS [SDL_SpinLock]
readList :: ReadS [SDL_SpinLock]
$creadPrec :: ReadPrec SDL_SpinLock
readPrec :: ReadPrec SDL_SpinLock
$creadListPrec :: ReadPrec [SDL_SpinLock]
readListPrec :: ReadPrec [SDL_SpinLock]
Read, Int -> SDL_SpinLock -> ShowS
[SDL_SpinLock] -> ShowS
SDL_SpinLock -> String
(Int -> SDL_SpinLock -> ShowS)
-> (SDL_SpinLock -> String)
-> ([SDL_SpinLock] -> ShowS)
-> Show SDL_SpinLock
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SDL_SpinLock -> ShowS
showsPrec :: Int -> SDL_SpinLock -> ShowS
$cshow :: SDL_SpinLock -> String
show :: SDL_SpinLock -> String
$cshowList :: [SDL_SpinLock] -> ShowS
showList :: [SDL_SpinLock] -> ShowS
Show)
  deriving newtype
    ( Word64 -> Int -> SDL_SpinLock
SDL_SpinLock -> Int -> Word64
(SDL_SpinLock -> Int -> Word64)
-> (Word64 -> Int -> SDL_SpinLock) -> Bitfield SDL_SpinLock
forall a.
(a -> Int -> Word64) -> (Word64 -> Int -> a) -> Bitfield a
$cnarrow :: SDL_SpinLock -> Int -> Word64
narrow :: SDL_SpinLock -> Int -> Word64
$cextend :: Word64 -> Int -> SDL_SpinLock
extend :: Word64 -> Int -> SDL_SpinLock
BG.Bitfield
    , Eq SDL_SpinLock
SDL_SpinLock
Eq SDL_SpinLock =>
(SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock)
-> (SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock)
-> (SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock)
-> (SDL_SpinLock -> SDL_SpinLock)
-> (SDL_SpinLock -> Int -> SDL_SpinLock)
-> (SDL_SpinLock -> Int -> SDL_SpinLock)
-> SDL_SpinLock
-> (Int -> SDL_SpinLock)
-> (SDL_SpinLock -> Int -> SDL_SpinLock)
-> (SDL_SpinLock -> Int -> SDL_SpinLock)
-> (SDL_SpinLock -> Int -> SDL_SpinLock)
-> (SDL_SpinLock -> Int -> Bool)
-> (SDL_SpinLock -> Maybe Int)
-> (SDL_SpinLock -> Int)
-> (SDL_SpinLock -> Bool)
-> (SDL_SpinLock -> Int -> SDL_SpinLock)
-> (SDL_SpinLock -> Int -> SDL_SpinLock)
-> (SDL_SpinLock -> Int -> SDL_SpinLock)
-> (SDL_SpinLock -> Int -> SDL_SpinLock)
-> (SDL_SpinLock -> Int -> SDL_SpinLock)
-> (SDL_SpinLock -> Int -> SDL_SpinLock)
-> (SDL_SpinLock -> Int)
-> Bits SDL_SpinLock
Int -> SDL_SpinLock
SDL_SpinLock -> Bool
SDL_SpinLock -> Int
SDL_SpinLock -> Maybe Int
SDL_SpinLock -> SDL_SpinLock
SDL_SpinLock -> Int -> Bool
SDL_SpinLock -> Int -> SDL_SpinLock
SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock
forall a.
Eq a =>
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> a
-> (Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> Bool)
-> (a -> Maybe Int)
-> (a -> Int)
-> (a -> Bool)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int)
-> Bits a
$c.&. :: SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock
.&. :: SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock
$c.|. :: SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock
.|. :: SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock
$cxor :: SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock
xor :: SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock
$ccomplement :: SDL_SpinLock -> SDL_SpinLock
complement :: SDL_SpinLock -> SDL_SpinLock
$cshift :: SDL_SpinLock -> Int -> SDL_SpinLock
shift :: SDL_SpinLock -> Int -> SDL_SpinLock
$crotate :: SDL_SpinLock -> Int -> SDL_SpinLock
rotate :: SDL_SpinLock -> Int -> SDL_SpinLock
$czeroBits :: SDL_SpinLock
zeroBits :: SDL_SpinLock
$cbit :: Int -> SDL_SpinLock
bit :: Int -> SDL_SpinLock
$csetBit :: SDL_SpinLock -> Int -> SDL_SpinLock
setBit :: SDL_SpinLock -> Int -> SDL_SpinLock
$cclearBit :: SDL_SpinLock -> Int -> SDL_SpinLock
clearBit :: SDL_SpinLock -> Int -> SDL_SpinLock
$ccomplementBit :: SDL_SpinLock -> Int -> SDL_SpinLock
complementBit :: SDL_SpinLock -> Int -> SDL_SpinLock
$ctestBit :: SDL_SpinLock -> Int -> Bool
testBit :: SDL_SpinLock -> Int -> Bool
$cbitSizeMaybe :: SDL_SpinLock -> Maybe Int
bitSizeMaybe :: SDL_SpinLock -> Maybe Int
$cbitSize :: SDL_SpinLock -> Int
bitSize :: SDL_SpinLock -> Int
$cisSigned :: SDL_SpinLock -> Bool
isSigned :: SDL_SpinLock -> Bool
$cshiftL :: SDL_SpinLock -> Int -> SDL_SpinLock
shiftL :: SDL_SpinLock -> Int -> SDL_SpinLock
$cunsafeShiftL :: SDL_SpinLock -> Int -> SDL_SpinLock
unsafeShiftL :: SDL_SpinLock -> Int -> SDL_SpinLock
$cshiftR :: SDL_SpinLock -> Int -> SDL_SpinLock
shiftR :: SDL_SpinLock -> Int -> SDL_SpinLock
$cunsafeShiftR :: SDL_SpinLock -> Int -> SDL_SpinLock
unsafeShiftR :: SDL_SpinLock -> Int -> SDL_SpinLock
$crotateL :: SDL_SpinLock -> Int -> SDL_SpinLock
rotateL :: SDL_SpinLock -> Int -> SDL_SpinLock
$crotateR :: SDL_SpinLock -> Int -> SDL_SpinLock
rotateR :: SDL_SpinLock -> Int -> SDL_SpinLock
$cpopCount :: SDL_SpinLock -> Int
popCount :: SDL_SpinLock -> Int
BG.Bits
    , Bits SDL_SpinLock
Bits SDL_SpinLock =>
(SDL_SpinLock -> Int)
-> (SDL_SpinLock -> Int)
-> (SDL_SpinLock -> Int)
-> FiniteBits SDL_SpinLock
SDL_SpinLock -> Int
forall b.
Bits b =>
(b -> Int) -> (b -> Int) -> (b -> Int) -> FiniteBits b
$cfiniteBitSize :: SDL_SpinLock -> Int
finiteBitSize :: SDL_SpinLock -> Int
$ccountLeadingZeros :: SDL_SpinLock -> Int
countLeadingZeros :: SDL_SpinLock -> Int
$ccountTrailingZeros :: SDL_SpinLock -> Int
countTrailingZeros :: SDL_SpinLock -> Int
BG.FiniteBits
    , FFIType SDL_SpinLock -> SDL_SpinLock
SDL_SpinLock -> FFIType SDL_SpinLock
(SDL_SpinLock -> FFIType SDL_SpinLock)
-> (FFIType SDL_SpinLock -> SDL_SpinLock)
-> HasFFIType SDL_SpinLock
forall a. (a -> FFIType a) -> (FFIType a -> a) -> HasFFIType a
$ctoFFIType :: SDL_SpinLock -> FFIType SDL_SpinLock
toFFIType :: SDL_SpinLock -> FFIType SDL_SpinLock
$cfromFFIType :: FFIType SDL_SpinLock -> SDL_SpinLock
fromFFIType :: FFIType SDL_SpinLock -> SDL_SpinLock
BG.HasFFIType
    , Ord SDL_SpinLock
Ord SDL_SpinLock =>
((SDL_SpinLock, SDL_SpinLock) -> [SDL_SpinLock])
-> ((SDL_SpinLock, SDL_SpinLock) -> SDL_SpinLock -> Int)
-> ((SDL_SpinLock, SDL_SpinLock) -> SDL_SpinLock -> Int)
-> ((SDL_SpinLock, SDL_SpinLock) -> SDL_SpinLock -> Bool)
-> ((SDL_SpinLock, SDL_SpinLock) -> Int)
-> ((SDL_SpinLock, SDL_SpinLock) -> Int)
-> Ix SDL_SpinLock
(SDL_SpinLock, SDL_SpinLock) -> Int
(SDL_SpinLock, SDL_SpinLock) -> [SDL_SpinLock]
(SDL_SpinLock, SDL_SpinLock) -> SDL_SpinLock -> Bool
(SDL_SpinLock, SDL_SpinLock) -> SDL_SpinLock -> Int
forall a.
Ord a =>
((a, a) -> [a])
-> ((a, a) -> a -> Int)
-> ((a, a) -> a -> Int)
-> ((a, a) -> a -> Bool)
-> ((a, a) -> Int)
-> ((a, a) -> Int)
-> Ix a
$crange :: (SDL_SpinLock, SDL_SpinLock) -> [SDL_SpinLock]
range :: (SDL_SpinLock, SDL_SpinLock) -> [SDL_SpinLock]
$cindex :: (SDL_SpinLock, SDL_SpinLock) -> SDL_SpinLock -> Int
index :: (SDL_SpinLock, SDL_SpinLock) -> SDL_SpinLock -> Int
$cunsafeIndex :: (SDL_SpinLock, SDL_SpinLock) -> SDL_SpinLock -> Int
unsafeIndex :: (SDL_SpinLock, SDL_SpinLock) -> SDL_SpinLock -> Int
$cinRange :: (SDL_SpinLock, SDL_SpinLock) -> SDL_SpinLock -> Bool
inRange :: (SDL_SpinLock, SDL_SpinLock) -> SDL_SpinLock -> Bool
$crangeSize :: (SDL_SpinLock, SDL_SpinLock) -> Int
rangeSize :: (SDL_SpinLock, SDL_SpinLock) -> Int
$cunsafeRangeSize :: (SDL_SpinLock, SDL_SpinLock) -> Int
unsafeRangeSize :: (SDL_SpinLock, SDL_SpinLock) -> Int
BG.Ix
    , Addr# -> Int# -> SDL_SpinLock
ByteArray# -> Int# -> SDL_SpinLock
Proxy SDL_SpinLock -> Int#
SDL_SpinLock -> Int#
(Proxy SDL_SpinLock -> Int#)
-> (SDL_SpinLock -> Int#)
-> (Proxy SDL_SpinLock -> Int#)
-> (SDL_SpinLock -> Int#)
-> (ByteArray# -> Int# -> SDL_SpinLock)
-> (forall s.
    MutableByteArray# s
    -> Int# -> State# s -> (# State# s, SDL_SpinLock #))
-> (forall s.
    MutableByteArray# s
    -> Int# -> SDL_SpinLock -> State# s -> State# s)
-> (forall s.
    MutableByteArray# s
    -> Int# -> Int# -> SDL_SpinLock -> State# s -> State# s)
-> (Addr# -> Int# -> SDL_SpinLock)
-> (forall s.
    Addr# -> Int# -> State# s -> (# State# s, SDL_SpinLock #))
-> (forall s.
    Addr# -> Int# -> SDL_SpinLock -> State# s -> State# s)
-> (forall s.
    Addr# -> Int# -> Int# -> SDL_SpinLock -> State# s -> State# s)
-> Prim SDL_SpinLock
forall s.
Addr# -> Int# -> Int# -> SDL_SpinLock -> State# s -> State# s
forall s. Addr# -> Int# -> State# s -> (# State# s, SDL_SpinLock #)
forall s. Addr# -> Int# -> SDL_SpinLock -> State# s -> State# s
forall s.
MutableByteArray# s
-> Int# -> Int# -> SDL_SpinLock -> State# s -> State# s
forall s.
MutableByteArray# s
-> Int# -> State# s -> (# State# s, SDL_SpinLock #)
forall s.
MutableByteArray# s -> Int# -> SDL_SpinLock -> State# s -> State# s
forall a.
(Proxy a -> Int#)
-> (a -> Int#)
-> (Proxy a -> Int#)
-> (a -> Int#)
-> (ByteArray# -> Int# -> a)
-> (forall s.
    MutableByteArray# s -> Int# -> State# s -> (# State# s, a #))
-> (forall s.
    MutableByteArray# s -> Int# -> a -> State# s -> State# s)
-> (forall s.
    MutableByteArray# s -> Int# -> Int# -> a -> State# s -> State# s)
-> (Addr# -> Int# -> a)
-> (forall s. Addr# -> Int# -> State# s -> (# State# s, a #))
-> (forall s. Addr# -> Int# -> a -> State# s -> State# s)
-> (forall s. Addr# -> Int# -> Int# -> a -> State# s -> State# s)
-> Prim a
$csizeOfType# :: Proxy SDL_SpinLock -> Int#
sizeOfType# :: Proxy SDL_SpinLock -> Int#
$csizeOf# :: SDL_SpinLock -> Int#
sizeOf# :: SDL_SpinLock -> Int#
$calignmentOfType# :: Proxy SDL_SpinLock -> Int#
alignmentOfType# :: Proxy SDL_SpinLock -> Int#
$calignment# :: SDL_SpinLock -> Int#
alignment# :: SDL_SpinLock -> Int#
$cindexByteArray# :: ByteArray# -> Int# -> SDL_SpinLock
indexByteArray# :: ByteArray# -> Int# -> SDL_SpinLock
$creadByteArray# :: forall s.
MutableByteArray# s
-> Int# -> State# s -> (# State# s, SDL_SpinLock #)
readByteArray# :: forall s.
MutableByteArray# s
-> Int# -> State# s -> (# State# s, SDL_SpinLock #)
$cwriteByteArray# :: forall s.
MutableByteArray# s -> Int# -> SDL_SpinLock -> State# s -> State# s
writeByteArray# :: forall s.
MutableByteArray# s -> Int# -> SDL_SpinLock -> State# s -> State# s
$csetByteArray# :: forall s.
MutableByteArray# s
-> Int# -> Int# -> SDL_SpinLock -> State# s -> State# s
setByteArray# :: forall s.
MutableByteArray# s
-> Int# -> Int# -> SDL_SpinLock -> State# s -> State# s
$cindexOffAddr# :: Addr# -> Int# -> SDL_SpinLock
indexOffAddr# :: Addr# -> Int# -> SDL_SpinLock
$creadOffAddr# :: forall s. Addr# -> Int# -> State# s -> (# State# s, SDL_SpinLock #)
readOffAddr# :: forall s. Addr# -> Int# -> State# s -> (# State# s, SDL_SpinLock #)
$cwriteOffAddr# :: forall s. Addr# -> Int# -> SDL_SpinLock -> State# s -> State# s
writeOffAddr# :: forall s. Addr# -> Int# -> SDL_SpinLock -> State# s -> State# s
$csetOffAddr# :: forall s.
Addr# -> Int# -> Int# -> SDL_SpinLock -> State# s -> State# s
setOffAddr# :: forall s.
Addr# -> Int# -> Int# -> SDL_SpinLock -> State# s -> State# s
BG.Prim
    , Ptr SDL_SpinLock -> IO SDL_SpinLock
Ptr SDL_SpinLock -> Int -> IO SDL_SpinLock
Ptr SDL_SpinLock -> Int -> SDL_SpinLock -> IO ()
Ptr SDL_SpinLock -> SDL_SpinLock -> IO ()
SDL_SpinLock -> Int
(SDL_SpinLock -> Int)
-> (SDL_SpinLock -> Int)
-> (Ptr SDL_SpinLock -> Int -> IO SDL_SpinLock)
-> (Ptr SDL_SpinLock -> Int -> SDL_SpinLock -> IO ())
-> (forall b. Ptr b -> Int -> IO SDL_SpinLock)
-> (forall b. Ptr b -> Int -> SDL_SpinLock -> IO ())
-> (Ptr SDL_SpinLock -> IO SDL_SpinLock)
-> (Ptr SDL_SpinLock -> SDL_SpinLock -> IO ())
-> Storable SDL_SpinLock
forall b. Ptr b -> Int -> IO SDL_SpinLock
forall b. Ptr b -> Int -> SDL_SpinLock -> IO ()
forall a.
(a -> Int)
-> (a -> Int)
-> (Ptr a -> Int -> IO a)
-> (Ptr a -> Int -> a -> IO ())
-> (forall b. Ptr b -> Int -> IO a)
-> (forall b. Ptr b -> Int -> a -> IO ())
-> (Ptr a -> IO a)
-> (Ptr a -> a -> IO ())
-> Storable a
$csizeOf :: SDL_SpinLock -> Int
sizeOf :: SDL_SpinLock -> Int
$calignment :: SDL_SpinLock -> Int
alignment :: SDL_SpinLock -> Int
$cpeekElemOff :: Ptr SDL_SpinLock -> Int -> IO SDL_SpinLock
peekElemOff :: Ptr SDL_SpinLock -> Int -> IO SDL_SpinLock
$cpokeElemOff :: Ptr SDL_SpinLock -> Int -> SDL_SpinLock -> IO ()
pokeElemOff :: Ptr SDL_SpinLock -> Int -> SDL_SpinLock -> IO ()
$cpeekByteOff :: forall b. Ptr b -> Int -> IO SDL_SpinLock
peekByteOff :: forall b. Ptr b -> Int -> IO SDL_SpinLock
$cpokeByteOff :: forall b. Ptr b -> Int -> SDL_SpinLock -> IO ()
pokeByteOff :: forall b. Ptr b -> Int -> SDL_SpinLock -> IO ()
$cpeek :: Ptr SDL_SpinLock -> IO SDL_SpinLock
peek :: Ptr SDL_SpinLock -> IO SDL_SpinLock
$cpoke :: Ptr SDL_SpinLock -> SDL_SpinLock -> IO ()
poke :: Ptr SDL_SpinLock -> SDL_SpinLock -> IO ()
BG.Storable
    , SDL_SpinLock
SDL_SpinLock -> SDL_SpinLock -> Bounded SDL_SpinLock
forall a. a -> a -> Bounded a
$cminBound :: SDL_SpinLock
minBound :: SDL_SpinLock
$cmaxBound :: SDL_SpinLock
maxBound :: SDL_SpinLock
Bounded
    , Int -> SDL_SpinLock
SDL_SpinLock -> Int
SDL_SpinLock -> [SDL_SpinLock]
SDL_SpinLock -> SDL_SpinLock
SDL_SpinLock -> SDL_SpinLock -> [SDL_SpinLock]
SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock -> [SDL_SpinLock]
(SDL_SpinLock -> SDL_SpinLock)
-> (SDL_SpinLock -> SDL_SpinLock)
-> (Int -> SDL_SpinLock)
-> (SDL_SpinLock -> Int)
-> (SDL_SpinLock -> [SDL_SpinLock])
-> (SDL_SpinLock -> SDL_SpinLock -> [SDL_SpinLock])
-> (SDL_SpinLock -> SDL_SpinLock -> [SDL_SpinLock])
-> (SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock -> [SDL_SpinLock])
-> Enum SDL_SpinLock
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: SDL_SpinLock -> SDL_SpinLock
succ :: SDL_SpinLock -> SDL_SpinLock
$cpred :: SDL_SpinLock -> SDL_SpinLock
pred :: SDL_SpinLock -> SDL_SpinLock
$ctoEnum :: Int -> SDL_SpinLock
toEnum :: Int -> SDL_SpinLock
$cfromEnum :: SDL_SpinLock -> Int
fromEnum :: SDL_SpinLock -> Int
$cenumFrom :: SDL_SpinLock -> [SDL_SpinLock]
enumFrom :: SDL_SpinLock -> [SDL_SpinLock]
$cenumFromThen :: SDL_SpinLock -> SDL_SpinLock -> [SDL_SpinLock]
enumFromThen :: SDL_SpinLock -> SDL_SpinLock -> [SDL_SpinLock]
$cenumFromTo :: SDL_SpinLock -> SDL_SpinLock -> [SDL_SpinLock]
enumFromTo :: SDL_SpinLock -> SDL_SpinLock -> [SDL_SpinLock]
$cenumFromThenTo :: SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock -> [SDL_SpinLock]
enumFromThenTo :: SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock -> [SDL_SpinLock]
Enum
    , Enum SDL_SpinLock
Real SDL_SpinLock
(Real SDL_SpinLock, Enum SDL_SpinLock) =>
(SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock)
-> (SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock)
-> (SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock)
-> (SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock)
-> (SDL_SpinLock -> SDL_SpinLock -> (SDL_SpinLock, SDL_SpinLock))
-> (SDL_SpinLock -> SDL_SpinLock -> (SDL_SpinLock, SDL_SpinLock))
-> (SDL_SpinLock -> Integer)
-> Integral SDL_SpinLock
SDL_SpinLock -> Integer
SDL_SpinLock -> SDL_SpinLock -> (SDL_SpinLock, SDL_SpinLock)
SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock
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
$cquot :: SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock
quot :: SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock
$crem :: SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock
rem :: SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock
$cdiv :: SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock
div :: SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock
$cmod :: SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock
mod :: SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock
$cquotRem :: SDL_SpinLock -> SDL_SpinLock -> (SDL_SpinLock, SDL_SpinLock)
quotRem :: SDL_SpinLock -> SDL_SpinLock -> (SDL_SpinLock, SDL_SpinLock)
$cdivMod :: SDL_SpinLock -> SDL_SpinLock -> (SDL_SpinLock, SDL_SpinLock)
divMod :: SDL_SpinLock -> SDL_SpinLock -> (SDL_SpinLock, SDL_SpinLock)
$ctoInteger :: SDL_SpinLock -> Integer
toInteger :: SDL_SpinLock -> Integer
Integral
    , Ptr SDL_SpinLock -> IO SDL_SpinLock
(Ptr SDL_SpinLock -> IO SDL_SpinLock) -> ReadRaw SDL_SpinLock
forall a. (Ptr a -> IO a) -> ReadRaw a
$creadRaw :: Ptr SDL_SpinLock -> IO SDL_SpinLock
readRaw :: Ptr SDL_SpinLock -> IO SDL_SpinLock
Marshal.ReadRaw
    , Proxy SDL_SpinLock -> Int
(Proxy SDL_SpinLock -> Int)
-> (Proxy SDL_SpinLock -> Int) -> StaticSize SDL_SpinLock
forall a. (Proxy a -> Int) -> (Proxy a -> Int) -> StaticSize a
$cstaticSizeOf :: Proxy SDL_SpinLock -> Int
staticSizeOf :: Proxy SDL_SpinLock -> Int
$cstaticAlignment :: Proxy SDL_SpinLock -> Int
staticAlignment :: Proxy SDL_SpinLock -> Int
Marshal.StaticSize
    , Ptr SDL_SpinLock -> SDL_SpinLock -> IO ()
(Ptr SDL_SpinLock -> SDL_SpinLock -> IO ())
-> WriteRaw SDL_SpinLock
forall a. (Ptr a -> a -> IO ()) -> WriteRaw a
$cwriteRaw :: Ptr SDL_SpinLock -> SDL_SpinLock -> IO ()
writeRaw :: Ptr SDL_SpinLock -> SDL_SpinLock -> IO ()
Marshal.WriteRaw
    , Integer -> SDL_SpinLock
SDL_SpinLock -> SDL_SpinLock
SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock
(SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock)
-> (SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock)
-> (SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock)
-> (SDL_SpinLock -> SDL_SpinLock)
-> (SDL_SpinLock -> SDL_SpinLock)
-> (SDL_SpinLock -> SDL_SpinLock)
-> (Integer -> SDL_SpinLock)
-> Num SDL_SpinLock
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
$c+ :: SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock
+ :: SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock
$c- :: SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock
- :: SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock
$c* :: SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock
* :: SDL_SpinLock -> SDL_SpinLock -> SDL_SpinLock
$cnegate :: SDL_SpinLock -> SDL_SpinLock
negate :: SDL_SpinLock -> SDL_SpinLock
$cabs :: SDL_SpinLock -> SDL_SpinLock
abs :: SDL_SpinLock -> SDL_SpinLock
$csignum :: SDL_SpinLock -> SDL_SpinLock
signum :: SDL_SpinLock -> SDL_SpinLock
$cfromInteger :: Integer -> SDL_SpinLock
fromInteger :: Integer -> SDL_SpinLock
Num
    , Num SDL_SpinLock
Ord SDL_SpinLock
(Num SDL_SpinLock, Ord SDL_SpinLock) =>
(SDL_SpinLock -> Rational) -> Real SDL_SpinLock
SDL_SpinLock -> Rational
forall a. (Num a, Ord a) => (a -> Rational) -> Real a
$ctoRational :: SDL_SpinLock -> Rational
toRational :: SDL_SpinLock -> Rational
Real
    )

instance
  (ty ~ BG.CInt)
  => BG.CompatHasField.HasField "unwrap" SDL_SpinLock ty
  where
  hasField :: SDL_SpinLock -> (ty -> SDL_SpinLock, ty)
hasField =
    \SDL_SpinLock
x0 ->
      ( \ty
y1 ->
          SDL_SpinLock{unwrap :: CInt
unwrap = ty
CInt
y1}
      , forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"unwrap" SDL_SpinLock
x0
      )

instance
  (ty ~ BG.CInt)
  => BG.HasField "unwrap" (BG.Ptr SDL_SpinLock) (BG.Ptr ty)
  where
  getField :: Ptr SDL_SpinLock -> Ptr ty
getField = Proxy "unwrap"
-> Ptr SDL_SpinLock -> Ptr (CFieldType SDL_SpinLock "unwrap")
forall a (field :: Symbol).
HasCField a field =>
Proxy field -> Ptr a -> Ptr (CFieldType a field)
HasCField.fromPtr (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"unwrap")

instance HasCField.HasCField SDL_SpinLock "unwrap" where
  type CFieldType SDL_SpinLock "unwrap" = BG.CInt

  offset# :: Proxy# SDL_SpinLock -> Proxy# "unwrap" -> Int
offset# = \Proxy# SDL_SpinLock
_ -> \Proxy# "unwrap"
_ -> Int
0

-- | A type representing an atomic integer value.
--
--     This can be used to manage a value that is synchronized across multiple CPUs without a race condition; when an app sets a value with SDL_SetAtomicInt all other threads, regardless of the CPU it is running on, will see that value when retrieved with SDL_GetAtomicInt, regardless of CPU caches, etc.
--
--     This is also useful for atomic compare-and-swap operations: a thread can change the value as long as its current value matches expectations. When done in a loop, one can guarantee data consistency across threads without a lock (but the usual warnings apply: if you don\'t know what you\'re doing, or you don\'t do it carefully, you can confidently cause any number of disasters with this, so in most cases, you /should/ use a mutex instead of this!).
--
--     This is a struct so people don\'t accidentally use numeric operations on it directly. You have to use SDL atomic functions.
--
--     @since 3.2.0
--
--     [See also]: 'sDL_CompareAndSwapAtomicInt', 'sDL_GetAtomicInt', 'sDL_SetAtomicInt', 'sDL_AddAtomicInt'
--
--     [C declaration]: @struct SDL_AtomicInt@, defined at @SDL3\/SDL_atomic.h 405:16@
data SDL_AtomicInt = SDL_AtomicInt
  { SDL_AtomicInt -> CInt
value :: BG.CInt
  -- ^ [C declaration]: @value@, defined at @SDL3\/SDL_atomic.h 405:36@
  }
  deriving stock ((forall x. SDL_AtomicInt -> Rep SDL_AtomicInt x)
-> (forall x. Rep SDL_AtomicInt x -> SDL_AtomicInt)
-> Generic SDL_AtomicInt
forall x. Rep SDL_AtomicInt x -> SDL_AtomicInt
forall x. SDL_AtomicInt -> Rep SDL_AtomicInt x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. SDL_AtomicInt -> Rep SDL_AtomicInt x
from :: forall x. SDL_AtomicInt -> Rep SDL_AtomicInt x
$cto :: forall x. Rep SDL_AtomicInt x -> SDL_AtomicInt
to :: forall x. Rep SDL_AtomicInt x -> SDL_AtomicInt
BG.Generic, SDL_AtomicInt -> SDL_AtomicInt -> Bool
(SDL_AtomicInt -> SDL_AtomicInt -> Bool)
-> (SDL_AtomicInt -> SDL_AtomicInt -> Bool) -> Eq SDL_AtomicInt
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SDL_AtomicInt -> SDL_AtomicInt -> Bool
== :: SDL_AtomicInt -> SDL_AtomicInt -> Bool
$c/= :: SDL_AtomicInt -> SDL_AtomicInt -> Bool
/= :: SDL_AtomicInt -> SDL_AtomicInt -> Bool
Eq, Int -> SDL_AtomicInt -> ShowS
[SDL_AtomicInt] -> ShowS
SDL_AtomicInt -> String
(Int -> SDL_AtomicInt -> ShowS)
-> (SDL_AtomicInt -> String)
-> ([SDL_AtomicInt] -> ShowS)
-> Show SDL_AtomicInt
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SDL_AtomicInt -> ShowS
showsPrec :: Int -> SDL_AtomicInt -> ShowS
$cshow :: SDL_AtomicInt -> String
show :: SDL_AtomicInt -> String
$cshowList :: [SDL_AtomicInt] -> ShowS
showList :: [SDL_AtomicInt] -> ShowS
Show)

instance Marshal.StaticSize SDL_AtomicInt where
  staticSizeOf :: Proxy SDL_AtomicInt -> Int
staticSizeOf = \Proxy SDL_AtomicInt
_ -> (Int
4 :: Int)

  staticAlignment :: Proxy SDL_AtomicInt -> Int
staticAlignment = \Proxy SDL_AtomicInt
_ -> (Int
4 :: Int)

instance Marshal.ReadRaw SDL_AtomicInt where
  readRaw :: Ptr SDL_AtomicInt -> IO SDL_AtomicInt
readRaw =
    \Ptr SDL_AtomicInt
ptr0 ->
      (CInt -> SDL_AtomicInt) -> IO (CInt -> SDL_AtomicInt)
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure CInt -> SDL_AtomicInt
SDL_AtomicInt
        IO (CInt -> SDL_AtomicInt) -> IO CInt -> IO SDL_AtomicInt
forall a b. IO (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy "value"
-> Ptr SDL_AtomicInt -> IO (CFieldType SDL_AtomicInt "value")
forall a (field :: Symbol).
(HasCField a field, ReadRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> IO (CFieldType a field)
HasCField.readRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"value") Ptr SDL_AtomicInt
ptr0

instance Marshal.WriteRaw SDL_AtomicInt where
  writeRaw :: Ptr SDL_AtomicInt -> SDL_AtomicInt -> IO ()
writeRaw =
    \Ptr SDL_AtomicInt
ptr0 ->
      \SDL_AtomicInt
s1 ->
        case SDL_AtomicInt
s1 of
          SDL_AtomicInt CInt
value2 ->
            Proxy "value"
-> Ptr SDL_AtomicInt -> CFieldType SDL_AtomicInt "value" -> IO ()
forall a (field :: Symbol).
(HasCField a field, WriteRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> CFieldType a field -> IO ()
HasCField.writeRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"value") Ptr SDL_AtomicInt
ptr0 CInt
CFieldType SDL_AtomicInt "value"
value2

deriving via Marshal.EquivStorable SDL_AtomicInt instance BG.Storable SDL_AtomicInt

deriving via Struct.IsStructViaReadRaw SDL_AtomicInt instance Struct.IsStruct SDL_AtomicInt

-- | [C declaration]: @value@, defined at @SDL3\/SDL_atomic.h 405:36@
instance
  (ty ~ BG.CInt)
  => BG.CompatHasField.HasField "value" SDL_AtomicInt ty
  where
  hasField :: SDL_AtomicInt -> (ty -> SDL_AtomicInt, ty)
hasField =
    \SDL_AtomicInt
x0 ->
      ( \ty
y1 ->
          SDL_AtomicInt{value :: CInt
value = ty
CInt
y1}
      , forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"value" SDL_AtomicInt
x0
      )

instance
  (ty ~ BG.CInt)
  => BG.HasField "value" (BG.Ptr SDL_AtomicInt) (BG.Ptr ty)
  where
  getField :: Ptr SDL_AtomicInt -> Ptr ty
getField = Proxy "value"
-> Ptr SDL_AtomicInt -> Ptr (CFieldType SDL_AtomicInt "value")
forall a (field :: Symbol).
HasCField a field =>
Proxy field -> Ptr a -> Ptr (CFieldType a field)
HasCField.fromPtr (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"value")

instance HasCField.HasCField SDL_AtomicInt "value" where
  type CFieldType SDL_AtomicInt "value" = BG.CInt

  offset# :: Proxy# SDL_AtomicInt -> Proxy# "value" -> Int
offset# = \Proxy# SDL_AtomicInt
_ -> \Proxy# "value"
_ -> Int
0

-- | A type representing an atomic unsigned 32-bit value.
--
--     This can be used to manage a value that is synchronized across multiple CPUs without a race condition; when an app sets a value with SDL_SetAtomicU32 all other threads, regardless of the CPU it is running on, will see that value when retrieved with SDL_GetAtomicU32, regardless of CPU caches, etc.
--
--     This is also useful for atomic compare-and-swap operations: a thread can change the value as long as its current value matches expectations. When done in a loop, one can guarantee data consistency across threads without a lock (but the usual warnings apply: if you don\'t know what you\'re doing, or you don\'t do it carefully, you can confidently cause any number of disasters with this, so in most cases, you /should/ use a mutex instead of this!).
--
--     This is a struct so people don\'t accidentally use numeric operations on it directly. You have to use SDL atomic functions.
--
--     @since 3.2.0
--
--     [See also]: 'sDL_CompareAndSwapAtomicU32', 'sDL_GetAtomicU32', 'sDL_SetAtomicU32'
--
--     [C declaration]: @struct SDL_AtomicU32@, defined at @SDL3\/SDL_atomic.h 550:16@
data SDL_AtomicU32 = SDL_AtomicU32
  { SDL_AtomicU32 -> Uint32
value :: SDL3.Sys.Bindgen.Stdinc.Uint32
  -- ^ [C declaration]: @value@, defined at @SDL3\/SDL_atomic.h 550:39@
  }
  deriving stock ((forall x. SDL_AtomicU32 -> Rep SDL_AtomicU32 x)
-> (forall x. Rep SDL_AtomicU32 x -> SDL_AtomicU32)
-> Generic SDL_AtomicU32
forall x. Rep SDL_AtomicU32 x -> SDL_AtomicU32
forall x. SDL_AtomicU32 -> Rep SDL_AtomicU32 x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. SDL_AtomicU32 -> Rep SDL_AtomicU32 x
from :: forall x. SDL_AtomicU32 -> Rep SDL_AtomicU32 x
$cto :: forall x. Rep SDL_AtomicU32 x -> SDL_AtomicU32
to :: forall x. Rep SDL_AtomicU32 x -> SDL_AtomicU32
BG.Generic, SDL_AtomicU32 -> SDL_AtomicU32 -> Bool
(SDL_AtomicU32 -> SDL_AtomicU32 -> Bool)
-> (SDL_AtomicU32 -> SDL_AtomicU32 -> Bool) -> Eq SDL_AtomicU32
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SDL_AtomicU32 -> SDL_AtomicU32 -> Bool
== :: SDL_AtomicU32 -> SDL_AtomicU32 -> Bool
$c/= :: SDL_AtomicU32 -> SDL_AtomicU32 -> Bool
/= :: SDL_AtomicU32 -> SDL_AtomicU32 -> Bool
Eq, Int -> SDL_AtomicU32 -> ShowS
[SDL_AtomicU32] -> ShowS
SDL_AtomicU32 -> String
(Int -> SDL_AtomicU32 -> ShowS)
-> (SDL_AtomicU32 -> String)
-> ([SDL_AtomicU32] -> ShowS)
-> Show SDL_AtomicU32
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SDL_AtomicU32 -> ShowS
showsPrec :: Int -> SDL_AtomicU32 -> ShowS
$cshow :: SDL_AtomicU32 -> String
show :: SDL_AtomicU32 -> String
$cshowList :: [SDL_AtomicU32] -> ShowS
showList :: [SDL_AtomicU32] -> ShowS
Show)

instance Marshal.StaticSize SDL_AtomicU32 where
  staticSizeOf :: Proxy SDL_AtomicU32 -> Int
staticSizeOf = \Proxy SDL_AtomicU32
_ -> (Int
4 :: Int)

  staticAlignment :: Proxy SDL_AtomicU32 -> Int
staticAlignment = \Proxy SDL_AtomicU32
_ -> (Int
4 :: Int)

instance Marshal.ReadRaw SDL_AtomicU32 where
  readRaw :: Ptr SDL_AtomicU32 -> IO SDL_AtomicU32
readRaw =
    \Ptr SDL_AtomicU32
ptr0 ->
      (Uint32 -> SDL_AtomicU32) -> IO (Uint32 -> SDL_AtomicU32)
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Uint32 -> SDL_AtomicU32
SDL_AtomicU32
        IO (Uint32 -> SDL_AtomicU32) -> IO Uint32 -> IO SDL_AtomicU32
forall a b. IO (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy "value"
-> Ptr SDL_AtomicU32 -> IO (CFieldType SDL_AtomicU32 "value")
forall a (field :: Symbol).
(HasCField a field, ReadRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> IO (CFieldType a field)
HasCField.readRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"value") Ptr SDL_AtomicU32
ptr0

instance Marshal.WriteRaw SDL_AtomicU32 where
  writeRaw :: Ptr SDL_AtomicU32 -> SDL_AtomicU32 -> IO ()
writeRaw =
    \Ptr SDL_AtomicU32
ptr0 ->
      \SDL_AtomicU32
s1 ->
        case SDL_AtomicU32
s1 of
          SDL_AtomicU32 Uint32
value2 ->
            Proxy "value"
-> Ptr SDL_AtomicU32 -> CFieldType SDL_AtomicU32 "value" -> IO ()
forall a (field :: Symbol).
(HasCField a field, WriteRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> CFieldType a field -> IO ()
HasCField.writeRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"value") Ptr SDL_AtomicU32
ptr0 CFieldType SDL_AtomicU32 "value"
Uint32
value2

deriving via Marshal.EquivStorable SDL_AtomicU32 instance BG.Storable SDL_AtomicU32

deriving via Struct.IsStructViaReadRaw SDL_AtomicU32 instance Struct.IsStruct SDL_AtomicU32

-- | [C declaration]: @value@, defined at @SDL3\/SDL_atomic.h 550:39@
instance
  (ty ~ SDL3.Sys.Bindgen.Stdinc.Uint32)
  => BG.CompatHasField.HasField "value" SDL_AtomicU32 ty
  where
  hasField :: SDL_AtomicU32 -> (ty -> SDL_AtomicU32, ty)
hasField =
    \SDL_AtomicU32
x0 ->
      ( \ty
y1 ->
          SDL_AtomicU32{value :: Uint32
value = ty
Uint32
y1}
      , forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"value" SDL_AtomicU32
x0
      )

instance
  (ty ~ SDL3.Sys.Bindgen.Stdinc.Uint32)
  => BG.HasField "value" (BG.Ptr SDL_AtomicU32) (BG.Ptr ty)
  where
  getField :: Ptr SDL_AtomicU32 -> Ptr ty
getField = Proxy "value"
-> Ptr SDL_AtomicU32 -> Ptr (CFieldType SDL_AtomicU32 "value")
forall a (field :: Symbol).
HasCField a field =>
Proxy field -> Ptr a -> Ptr (CFieldType a field)
HasCField.fromPtr (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"value")

instance HasCField.HasCField SDL_AtomicU32 "value" where
  type
    CFieldType SDL_AtomicU32 "value" =
      SDL3.Sys.Bindgen.Stdinc.Uint32

  offset# :: Proxy# SDL_AtomicU32 -> Proxy# "value" -> Int
offset# = \Proxy# SDL_AtomicU32
_ -> \Proxy# "value"
_ -> Int
0