{-# language CPP #-}
module OpenXR.Version ( pattern CURRENT_API_VERSION
, pattern MAKE_VERSION
, _VERSION_MAJOR
, _VERSION_MINOR
, _VERSION_PATCH
, Version(..)
) where
import Data.Bits ((.&.))
import Data.Bits ((.|.))
import Data.Bits (shiftL)
import Data.Bits (shiftR)
import OpenXR.Zero (Zero)
import Data.Typeable (Typeable)
import Foreign.Storable (Storable)
import GHC.Generics (Generic)
import Data.Word (Word16)
import Data.Word (Word32)
import Data.Word (Word64)
pattern CURRENT_API_VERSION :: Version
pattern $bCURRENT_API_VERSION :: Version
$mCURRENT_API_VERSION :: forall r. Version -> (Void# -> r) -> (Void# -> r) -> r
CURRENT_API_VERSION = MAKE_VERSION 1 0 13
pattern MAKE_VERSION :: Word16 -> Word16 -> Word32 -> Version
pattern $bMAKE_VERSION :: Word16 -> Word16 -> Word32 -> Version
$mMAKE_VERSION :: forall r.
Version -> (Word16 -> Word16 -> Word32 -> r) -> (Void# -> r) -> r
MAKE_VERSION major minor patch <-
(\v -> (_VERSION_MAJOR v, _VERSION_MINOR v, _VERSION_PATCH v) -> (major, minor, patch))
where MAKE_VERSION major :: Word16
major minor :: Word16
minor patch :: Word32
patch = Word64 -> Version
Version
(Word64 -> Version) -> Word64 -> Version
forall a b. (a -> b) -> a -> b
$ Word16 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word16
major Word64 -> Int -> Word64
forall a. Bits a => a -> Int -> a
`shiftL` 48
Word64 -> Word64 -> Word64
forall a. Bits a => a -> a -> a
.|. Word16 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word16
minor Word64 -> Int -> Word64
forall a. Bits a => a -> Int -> a
`shiftL` 32
Word64 -> Word64 -> Word64
forall a. Bits a => a -> a -> a
.|. Word32 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word32
patch
_VERSION_MAJOR :: Version -> Word16
_VERSION_MAJOR :: Version -> Word16
_VERSION_MAJOR (Version v :: Word64
v) = Word64 -> Word16
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word64 -> Word16) -> Word64 -> Word16
forall a b. (a -> b) -> a -> b
$ (Word64
v Word64 -> Int -> Word64
forall a. Bits a => a -> Int -> a
`shiftR` 48) Word64 -> Word64 -> Word64
forall a. Bits a => a -> a -> a
.&. 0xffff
_VERSION_MINOR :: Version -> Word16
_VERSION_MINOR :: Version -> Word16
_VERSION_MINOR (Version v :: Word64
v) = Word64 -> Word16
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word64 -> Word16) -> Word64 -> Word16
forall a b. (a -> b) -> a -> b
$ (Word64
v Word64 -> Int -> Word64
forall a. Bits a => a -> Int -> a
`shiftR` 32) Word64 -> Word64 -> Word64
forall a. Bits a => a -> a -> a
.&. 0xffff
_VERSION_PATCH :: Version -> Word32
_VERSION_PATCH :: Version -> Word32
_VERSION_PATCH (Version v :: Word64
v) = Word64 -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word64 -> Word32) -> Word64 -> Word32
forall a b. (a -> b) -> a -> b
$ Word64
v Word64 -> Word64 -> Word64
forall a. Bits a => a -> a -> a
.&. 0xffffffff
newtype Version = Version { Version -> Word64
unVersion :: Word64 }
deriving stock (Typeable, Version -> Version -> Bool
(Version -> Version -> Bool)
-> (Version -> Version -> Bool) -> Eq Version
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Version -> Version -> Bool
$c/= :: Version -> Version -> Bool
== :: Version -> Version -> Bool
$c== :: Version -> Version -> Bool
Eq, Eq Version
Eq Version =>
(Version -> Version -> Ordering)
-> (Version -> Version -> Bool)
-> (Version -> Version -> Bool)
-> (Version -> Version -> Bool)
-> (Version -> Version -> Bool)
-> (Version -> Version -> Version)
-> (Version -> Version -> Version)
-> Ord Version
Version -> Version -> Bool
Version -> Version -> Ordering
Version -> Version -> Version
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 :: Version -> Version -> Version
$cmin :: Version -> Version -> Version
max :: Version -> Version -> Version
$cmax :: Version -> Version -> Version
>= :: Version -> Version -> Bool
$c>= :: Version -> Version -> Bool
> :: Version -> Version -> Bool
$c> :: Version -> Version -> Bool
<= :: Version -> Version -> Bool
$c<= :: Version -> Version -> Bool
< :: Version -> Version -> Bool
$c< :: Version -> Version -> Bool
compare :: Version -> Version -> Ordering
$ccompare :: Version -> Version -> Ordering
$cp1Ord :: Eq Version
Ord, Int -> Version -> ShowS
[Version] -> ShowS
Version -> String
(Int -> Version -> ShowS)
-> (Version -> String) -> ([Version] -> ShowS) -> Show Version
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Version] -> ShowS
$cshowList :: [Version] -> ShowS
show :: Version -> String
$cshow :: Version -> String
showsPrec :: Int -> Version -> ShowS
$cshowsPrec :: Int -> Version -> ShowS
Show, ReadPrec [Version]
ReadPrec Version
Int -> ReadS Version
ReadS [Version]
(Int -> ReadS Version)
-> ReadS [Version]
-> ReadPrec Version
-> ReadPrec [Version]
-> Read Version
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Version]
$creadListPrec :: ReadPrec [Version]
readPrec :: ReadPrec Version
$creadPrec :: ReadPrec Version
readList :: ReadS [Version]
$creadList :: ReadS [Version]
readsPrec :: Int -> ReadS Version
$creadsPrec :: Int -> ReadS Version
Read)
deriving newtype (Ptr b -> Int -> IO Version
Ptr b -> Int -> Version -> IO ()
Ptr Version -> IO Version
Ptr Version -> Int -> IO Version
Ptr Version -> Int -> Version -> IO ()
Ptr Version -> Version -> IO ()
Version -> Int
(Version -> Int)
-> (Version -> Int)
-> (Ptr Version -> Int -> IO Version)
-> (Ptr Version -> Int -> Version -> IO ())
-> (forall b. Ptr b -> Int -> IO Version)
-> (forall b. Ptr b -> Int -> Version -> IO ())
-> (Ptr Version -> IO Version)
-> (Ptr Version -> Version -> IO ())
-> Storable Version
forall b. Ptr b -> Int -> IO Version
forall b. Ptr b -> Int -> Version -> 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
poke :: Ptr Version -> Version -> IO ()
$cpoke :: Ptr Version -> Version -> IO ()
peek :: Ptr Version -> IO Version
$cpeek :: Ptr Version -> IO Version
pokeByteOff :: Ptr b -> Int -> Version -> IO ()
$cpokeByteOff :: forall b. Ptr b -> Int -> Version -> IO ()
peekByteOff :: Ptr b -> Int -> IO Version
$cpeekByteOff :: forall b. Ptr b -> Int -> IO Version
pokeElemOff :: Ptr Version -> Int -> Version -> IO ()
$cpokeElemOff :: Ptr Version -> Int -> Version -> IO ()
peekElemOff :: Ptr Version -> Int -> IO Version
$cpeekElemOff :: Ptr Version -> Int -> IO Version
alignment :: Version -> Int
$calignment :: Version -> Int
sizeOf :: Version -> Int
$csizeOf :: Version -> Int
Storable, Version
Version -> Zero Version
forall a. a -> Zero a
zero :: Version
$czero :: Version
Zero)
#if defined(GENERIC_INSTANCES)
deriving instance Generic Version
#endif