1/*
2 * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved.
3 *
4 * NVIDIA CORPORATION and its licensors retain all intellectual property
5 * and proprietary rights in and to this software, related documentation
6 * and any modifications thereto. Any use, reproduction, disclosure or
7 * distribution of this software and related documentation without an express
8 * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 */
10// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
11// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
12
13
14#ifndef PX_FOUNDATION_PX_UNION_CAST_H
15#define PX_FOUNDATION_PX_UNION_CAST_H
16
17#include "foundation/PxPreprocessor.h"
18
19/** \addtogroup foundation
20@{
21*/
22
23#ifndef PX_DOXYGEN
24namespace physx
25{
26#endif
27
28template<class A, class B> PX_FORCE_INLINE A PxUnionCast(B b)
29{
30 union AB
31 {
32 AB(B bb)
33 : _b(bb)
34 {
35 }
36 B _b;
37 A _a;
38 } u(b);
39 return u._a;
40}
41
42#ifndef PX_DOXYGEN
43} // namespace physx
44#endif
45
46/** @} */
47
48#endif
49