{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE TypeSynonymInstances #-}

module Data.SpirV.Enum.MemoryAccess where

import Data.Bits (Bits, FiniteBits, (.|.))
import Data.Word (Word32)
import Foreign.Storable (Storable)

type MemoryAccess = MemoryAccessBits

newtype MemoryAccessBits = MemoryAccessBits Word32
  deriving newtype (MemoryAccessBits -> MemoryAccessBits -> Bool
(MemoryAccessBits -> MemoryAccessBits -> Bool)
-> (MemoryAccessBits -> MemoryAccessBits -> Bool)
-> Eq MemoryAccessBits
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: MemoryAccessBits -> MemoryAccessBits -> Bool
== :: MemoryAccessBits -> MemoryAccessBits -> Bool
$c/= :: MemoryAccessBits -> MemoryAccessBits -> Bool
/= :: MemoryAccessBits -> MemoryAccessBits -> Bool
Eq, Eq MemoryAccessBits
Eq MemoryAccessBits =>
(MemoryAccessBits -> MemoryAccessBits -> Ordering)
-> (MemoryAccessBits -> MemoryAccessBits -> Bool)
-> (MemoryAccessBits -> MemoryAccessBits -> Bool)
-> (MemoryAccessBits -> MemoryAccessBits -> Bool)
-> (MemoryAccessBits -> MemoryAccessBits -> Bool)
-> (MemoryAccessBits -> MemoryAccessBits -> MemoryAccessBits)
-> (MemoryAccessBits -> MemoryAccessBits -> MemoryAccessBits)
-> Ord MemoryAccessBits
MemoryAccessBits -> MemoryAccessBits -> Bool
MemoryAccessBits -> MemoryAccessBits -> Ordering
MemoryAccessBits -> MemoryAccessBits -> MemoryAccessBits
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 :: MemoryAccessBits -> MemoryAccessBits -> Ordering
compare :: MemoryAccessBits -> MemoryAccessBits -> Ordering
$c< :: MemoryAccessBits -> MemoryAccessBits -> Bool
< :: MemoryAccessBits -> MemoryAccessBits -> Bool
$c<= :: MemoryAccessBits -> MemoryAccessBits -> Bool
<= :: MemoryAccessBits -> MemoryAccessBits -> Bool
$c> :: MemoryAccessBits -> MemoryAccessBits -> Bool
> :: MemoryAccessBits -> MemoryAccessBits -> Bool
$c>= :: MemoryAccessBits -> MemoryAccessBits -> Bool
>= :: MemoryAccessBits -> MemoryAccessBits -> Bool
$cmax :: MemoryAccessBits -> MemoryAccessBits -> MemoryAccessBits
max :: MemoryAccessBits -> MemoryAccessBits -> MemoryAccessBits
$cmin :: MemoryAccessBits -> MemoryAccessBits -> MemoryAccessBits
min :: MemoryAccessBits -> MemoryAccessBits -> MemoryAccessBits
Ord, Ptr MemoryAccessBits -> IO MemoryAccessBits
Ptr MemoryAccessBits -> Int -> IO MemoryAccessBits
Ptr MemoryAccessBits -> Int -> MemoryAccessBits -> IO ()
Ptr MemoryAccessBits -> MemoryAccessBits -> IO ()
MemoryAccessBits -> Int
(MemoryAccessBits -> Int)
-> (MemoryAccessBits -> Int)
-> (Ptr MemoryAccessBits -> Int -> IO MemoryAccessBits)
-> (Ptr MemoryAccessBits -> Int -> MemoryAccessBits -> IO ())
-> (forall b. Ptr b -> Int -> IO MemoryAccessBits)
-> (forall b. Ptr b -> Int -> MemoryAccessBits -> IO ())
-> (Ptr MemoryAccessBits -> IO MemoryAccessBits)
-> (Ptr MemoryAccessBits -> MemoryAccessBits -> IO ())
-> Storable MemoryAccessBits
forall b. Ptr b -> Int -> IO MemoryAccessBits
forall b. Ptr b -> Int -> MemoryAccessBits -> 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 :: MemoryAccessBits -> Int
sizeOf :: MemoryAccessBits -> Int
$calignment :: MemoryAccessBits -> Int
alignment :: MemoryAccessBits -> Int
$cpeekElemOff :: Ptr MemoryAccessBits -> Int -> IO MemoryAccessBits
peekElemOff :: Ptr MemoryAccessBits -> Int -> IO MemoryAccessBits
$cpokeElemOff :: Ptr MemoryAccessBits -> Int -> MemoryAccessBits -> IO ()
pokeElemOff :: Ptr MemoryAccessBits -> Int -> MemoryAccessBits -> IO ()
$cpeekByteOff :: forall b. Ptr b -> Int -> IO MemoryAccessBits
peekByteOff :: forall b. Ptr b -> Int -> IO MemoryAccessBits
$cpokeByteOff :: forall b. Ptr b -> Int -> MemoryAccessBits -> IO ()
pokeByteOff :: forall b. Ptr b -> Int -> MemoryAccessBits -> IO ()
$cpeek :: Ptr MemoryAccessBits -> IO MemoryAccessBits
peek :: Ptr MemoryAccessBits -> IO MemoryAccessBits
$cpoke :: Ptr MemoryAccessBits -> MemoryAccessBits -> IO ()
poke :: Ptr MemoryAccessBits -> MemoryAccessBits -> IO ()
Storable, Eq MemoryAccessBits
MemoryAccessBits
Eq MemoryAccessBits =>
(MemoryAccessBits -> MemoryAccessBits -> MemoryAccessBits)
-> (MemoryAccessBits -> MemoryAccessBits -> MemoryAccessBits)
-> (MemoryAccessBits -> MemoryAccessBits -> MemoryAccessBits)
-> (MemoryAccessBits -> MemoryAccessBits)
-> (MemoryAccessBits -> Int -> MemoryAccessBits)
-> (MemoryAccessBits -> Int -> MemoryAccessBits)
-> MemoryAccessBits
-> (Int -> MemoryAccessBits)
-> (MemoryAccessBits -> Int -> MemoryAccessBits)
-> (MemoryAccessBits -> Int -> MemoryAccessBits)
-> (MemoryAccessBits -> Int -> MemoryAccessBits)
-> (MemoryAccessBits -> Int -> Bool)
-> (MemoryAccessBits -> Maybe Int)
-> (MemoryAccessBits -> Int)
-> (MemoryAccessBits -> Bool)
-> (MemoryAccessBits -> Int -> MemoryAccessBits)
-> (MemoryAccessBits -> Int -> MemoryAccessBits)
-> (MemoryAccessBits -> Int -> MemoryAccessBits)
-> (MemoryAccessBits -> Int -> MemoryAccessBits)
-> (MemoryAccessBits -> Int -> MemoryAccessBits)
-> (MemoryAccessBits -> Int -> MemoryAccessBits)
-> (MemoryAccessBits -> Int)
-> Bits MemoryAccessBits
Int -> MemoryAccessBits
MemoryAccessBits -> Bool
MemoryAccessBits -> Int
MemoryAccessBits -> Maybe Int
MemoryAccessBits -> MemoryAccessBits
MemoryAccessBits -> Int -> Bool
MemoryAccessBits -> Int -> MemoryAccessBits
MemoryAccessBits -> MemoryAccessBits -> MemoryAccessBits
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.&. :: MemoryAccessBits -> MemoryAccessBits -> MemoryAccessBits
.&. :: MemoryAccessBits -> MemoryAccessBits -> MemoryAccessBits
$c.|. :: MemoryAccessBits -> MemoryAccessBits -> MemoryAccessBits
.|. :: MemoryAccessBits -> MemoryAccessBits -> MemoryAccessBits
$cxor :: MemoryAccessBits -> MemoryAccessBits -> MemoryAccessBits
xor :: MemoryAccessBits -> MemoryAccessBits -> MemoryAccessBits
$ccomplement :: MemoryAccessBits -> MemoryAccessBits
complement :: MemoryAccessBits -> MemoryAccessBits
$cshift :: MemoryAccessBits -> Int -> MemoryAccessBits
shift :: MemoryAccessBits -> Int -> MemoryAccessBits
$crotate :: MemoryAccessBits -> Int -> MemoryAccessBits
rotate :: MemoryAccessBits -> Int -> MemoryAccessBits
$czeroBits :: MemoryAccessBits
zeroBits :: MemoryAccessBits
$cbit :: Int -> MemoryAccessBits
bit :: Int -> MemoryAccessBits
$csetBit :: MemoryAccessBits -> Int -> MemoryAccessBits
setBit :: MemoryAccessBits -> Int -> MemoryAccessBits
$cclearBit :: MemoryAccessBits -> Int -> MemoryAccessBits
clearBit :: MemoryAccessBits -> Int -> MemoryAccessBits
$ccomplementBit :: MemoryAccessBits -> Int -> MemoryAccessBits
complementBit :: MemoryAccessBits -> Int -> MemoryAccessBits
$ctestBit :: MemoryAccessBits -> Int -> Bool
testBit :: MemoryAccessBits -> Int -> Bool
$cbitSizeMaybe :: MemoryAccessBits -> Maybe Int
bitSizeMaybe :: MemoryAccessBits -> Maybe Int
$cbitSize :: MemoryAccessBits -> Int
bitSize :: MemoryAccessBits -> Int
$cisSigned :: MemoryAccessBits -> Bool
isSigned :: MemoryAccessBits -> Bool
$cshiftL :: MemoryAccessBits -> Int -> MemoryAccessBits
shiftL :: MemoryAccessBits -> Int -> MemoryAccessBits
$cunsafeShiftL :: MemoryAccessBits -> Int -> MemoryAccessBits
unsafeShiftL :: MemoryAccessBits -> Int -> MemoryAccessBits
$cshiftR :: MemoryAccessBits -> Int -> MemoryAccessBits
shiftR :: MemoryAccessBits -> Int -> MemoryAccessBits
$cunsafeShiftR :: MemoryAccessBits -> Int -> MemoryAccessBits
unsafeShiftR :: MemoryAccessBits -> Int -> MemoryAccessBits
$crotateL :: MemoryAccessBits -> Int -> MemoryAccessBits
rotateL :: MemoryAccessBits -> Int -> MemoryAccessBits
$crotateR :: MemoryAccessBits -> Int -> MemoryAccessBits
rotateR :: MemoryAccessBits -> Int -> MemoryAccessBits
$cpopCount :: MemoryAccessBits -> Int
popCount :: MemoryAccessBits -> Int
Bits, Bits MemoryAccessBits
Bits MemoryAccessBits =>
(MemoryAccessBits -> Int)
-> (MemoryAccessBits -> Int)
-> (MemoryAccessBits -> Int)
-> FiniteBits MemoryAccessBits
MemoryAccessBits -> Int
forall b.
Bits b =>
(b -> Int) -> (b -> Int) -> (b -> Int) -> FiniteBits b
$cfiniteBitSize :: MemoryAccessBits -> Int
finiteBitSize :: MemoryAccessBits -> Int
$ccountLeadingZeros :: MemoryAccessBits -> Int
countLeadingZeros :: MemoryAccessBits -> Int
$ccountTrailingZeros :: MemoryAccessBits -> Int
countTrailingZeros :: MemoryAccessBits -> Int
FiniteBits)

instance Semigroup MemoryAccess where
  (MemoryAccessBits Word32
a) <> :: MemoryAccessBits -> MemoryAccessBits -> MemoryAccessBits
<> (MemoryAccessBits Word32
b) = Word32 -> MemoryAccessBits
MemoryAccessBits (Word32
a Word32 -> Word32 -> Word32
forall a. Bits a => a -> a -> a
.|. Word32
b)

instance Monoid MemoryAccess where
  mempty :: MemoryAccessBits
mempty = Word32 -> MemoryAccessBits
MemoryAccessBits Word32
0

pattern Volatile :: MemoryAccessBits
pattern $mVolatile :: forall {r}. MemoryAccessBits -> ((# #) -> r) -> ((# #) -> r) -> r
$bVolatile :: MemoryAccessBits
Volatile = MemoryAccessBits 0x00000001

pattern Aligned :: MemoryAccessBits
pattern $mAligned :: forall {r}. MemoryAccessBits -> ((# #) -> r) -> ((# #) -> r) -> r
$bAligned :: MemoryAccessBits
Aligned = MemoryAccessBits 0x00000002

pattern Nontemporal :: MemoryAccessBits
pattern $mNontemporal :: forall {r}. MemoryAccessBits -> ((# #) -> r) -> ((# #) -> r) -> r
$bNontemporal :: MemoryAccessBits
Nontemporal = MemoryAccessBits 0x00000004

pattern MakePointerAvailable :: MemoryAccessBits
pattern $mMakePointerAvailable :: forall {r}. MemoryAccessBits -> ((# #) -> r) -> ((# #) -> r) -> r
$bMakePointerAvailable :: MemoryAccessBits
MakePointerAvailable = MemoryAccessBits 0x00000008

pattern MakePointerAvailableKHR :: MemoryAccessBits
pattern $mMakePointerAvailableKHR :: forall {r}. MemoryAccessBits -> ((# #) -> r) -> ((# #) -> r) -> r
$bMakePointerAvailableKHR :: MemoryAccessBits
MakePointerAvailableKHR = MemoryAccessBits 0x00000008

pattern MakePointerVisible :: MemoryAccessBits
pattern $mMakePointerVisible :: forall {r}. MemoryAccessBits -> ((# #) -> r) -> ((# #) -> r) -> r
$bMakePointerVisible :: MemoryAccessBits
MakePointerVisible = MemoryAccessBits 0x00000010

pattern MakePointerVisibleKHR :: MemoryAccessBits
pattern $mMakePointerVisibleKHR :: forall {r}. MemoryAccessBits -> ((# #) -> r) -> ((# #) -> r) -> r
$bMakePointerVisibleKHR :: MemoryAccessBits
MakePointerVisibleKHR = MemoryAccessBits 0x00000010

pattern NonPrivatePointer :: MemoryAccessBits
pattern $mNonPrivatePointer :: forall {r}. MemoryAccessBits -> ((# #) -> r) -> ((# #) -> r) -> r
$bNonPrivatePointer :: MemoryAccessBits
NonPrivatePointer = MemoryAccessBits 0x00000020

pattern NonPrivatePointerKHR :: MemoryAccessBits
pattern $mNonPrivatePointerKHR :: forall {r}. MemoryAccessBits -> ((# #) -> r) -> ((# #) -> r) -> r
$bNonPrivatePointerKHR :: MemoryAccessBits
NonPrivatePointerKHR = MemoryAccessBits 0x00000020

pattern AliasScopeINTELMask :: MemoryAccessBits
pattern $mAliasScopeINTELMask :: forall {r}. MemoryAccessBits -> ((# #) -> r) -> ((# #) -> r) -> r
$bAliasScopeINTELMask :: MemoryAccessBits
AliasScopeINTELMask = MemoryAccessBits 0x00010000

pattern NoAliasINTELMask :: MemoryAccessBits
pattern $mNoAliasINTELMask :: forall {r}. MemoryAccessBits -> ((# #) -> r) -> ((# #) -> r) -> r
$bNoAliasINTELMask :: MemoryAccessBits
NoAliasINTELMask = MemoryAccessBits 0x00020000