mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-16 11:55:39 +00:00
st/oxr: Add XRT_CAST_OXR_HANDLE_TO_PTR macro
This commit is contained in:
parent
cecb8f31af
commit
d95219810e
|
@ -44,6 +44,18 @@ extern "C" {
|
|||
#define XRT_CAST_PTR_TO_OXR_HANDLE(HANDLE_TYPE, PTR) \
|
||||
((HANDLE_TYPE)(uint64_t)(uintptr_t)(PTR))
|
||||
|
||||
/*!
|
||||
* @brief Cast an OpenXR handle to a pointer in such a way as to avoid warnings.
|
||||
*
|
||||
* Avoids -Wint-to-pointer-cast by first casting to a 64-bit int, then to a
|
||||
* pointer-sized int, then to the desired pointer type. That's a lot of no-ops
|
||||
* on 64-bit, but a narrowing (!) conversion on 32-bit.
|
||||
*
|
||||
* @ingroup oxr
|
||||
*/
|
||||
#define XRT_CAST_OXR_HANDLE_TO_PTR(PTR_TYPE, HANDLE) \
|
||||
((PTR_TYPE)(uintptr_t)(uint64_t)(HANDLE))
|
||||
|
||||
/*!
|
||||
* @defgroup oxr_main OpenXR main code
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue