PxSimpleTypes.h
Go to the documentation of this file.
1 //
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions
4 // are met:
5 // * Redistributions of source code must retain the above copyright
6 // notice, this list of conditions and the following disclaimer.
7 // * Redistributions in binary form must reproduce the above copyright
8 // notice, this list of conditions and the following disclaimer in the
9 // documentation and/or other materials provided with the distribution.
10 // * Neither the name of NVIDIA CORPORATION nor the names of its
11 // contributors may be used to endorse or promote products derived
12 // from this software without specific prior written permission.
13 //
14 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
15 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
18 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 //
26 // Copyright (c) 2008-2018 NVIDIA Corporation. All rights reserved.
27 // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
28 // Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
29 
30 #ifndef PXFOUNDATION_PXSIMPLETYPES_H
31 #define PXFOUNDATION_PXSIMPLETYPES_H
32 
37 // Platform specific types:
38 // Design note: Its OK to use int for general loop variables and temps.
39 
41 #if PX_VC
42 #pragma warning(push)
43 #pragma warning(disable : 4668) // suppressing warning generated by Microsoft Visual Studio when including this standard
44 // header
45 #endif
46 
47 #if PX_LINUX
48 #define __STDC_LIMIT_MACROS
49 #endif
50 
51 #include <stdint.h>
52 #if PX_VC
53 #pragma warning(pop)
54 #endif
55 
56 #if PX_VC // we could use inttypes.h starting with VC12
57 #define PX_PRIu64 "I64u"
58 #else
59 #if !PX_PS4 && !PX_APPLE_FAMILY
60 #define __STDC_FORMAT_MACROS
61 #endif
62 #include <inttypes.h>
63 #define PX_PRIu64 PRIu64
64 #endif
65 
66 namespace physx
67 {
68 typedef int64_t PxI64;
69 typedef uint64_t PxU64;
70 typedef int32_t PxI32;
71 typedef uint32_t PxU32;
72 typedef int16_t PxI16;
73 typedef uint16_t PxU16;
74 typedef int8_t PxI8;
75 typedef uint8_t PxU8;
76 typedef float PxF32;
77 typedef double PxF64;
78 typedef float PxReal;
79 }
80 
81 // Type ranges
82 
83 // These are here because we sometimes have non-IEEE compliant platforms to deal with.
84 // Removal is under consideration (issue GWSD-34)
85 
86 #define PX_MAX_F32 3.4028234663852885981170418348452e+38F
87 // maximum possible float value
88 #define PX_MAX_F64 DBL_MAX // maximum possible double value
89 
90 #define PX_EPS_F32 FLT_EPSILON // maximum relative error of float rounding
91 #define PX_EPS_F64 DBL_EPSILON // maximum relative error of double rounding
92 
93 #define PX_MAX_REAL PX_MAX_F32
94 #define PX_EPS_REAL PX_EPS_F32
95 #define PX_NORMALIZATION_EPSILON float(1e-20f)
96 
97 // Legacy type ranges used by PhysX
98 #define PX_MAX_I8 INT8_MAX
99 #define PX_MIN_I8 INT8_MIN
100 #define PX_MAX_U8 UINT8_MAX
101 #define PX_MIN_U8 UINT8_MIN
102 #define PX_MAX_I16 INT16_MAX
103 #define PX_MIN_I16 INT16_MIN
104 #define PX_MAX_U16 UINT16_MAX
105 #define PX_MIN_U16 UINT16_MIN
106 #define PX_MAX_I32 INT32_MAX
107 #define PX_MIN_I32 INT32_MIN
108 #define PX_MAX_U32 UINT32_MAX
109 #define PX_MIN_U32 UINT32_MIN
110 
112 #endif // #ifndef PXFOUNDATION_PXSIMPLETYPES_H
Definition: GuContactBuffer.h:37
float PxF32
Definition: PxSimpleTypes.h:76
float PxReal
Definition: PxSimpleTypes.h:78
int16_t PxI16
Definition: PxSimpleTypes.h:72
uint32_t PxU32
Definition: PxSimpleTypes.h:71
uint64_t PxU64
Definition: PxSimpleTypes.h:69
uint8_t PxU8
Definition: PxSimpleTypes.h:75
double PxF64
Definition: PxSimpleTypes.h:77
int32_t PxI32
Definition: PxSimpleTypes.h:70
int8_t PxI8
Definition: PxSimpleTypes.h:74
int64_t PxI64
Definition: PxSimpleTypes.h:68
uint16_t PxU16
Definition: PxSimpleTypes.h:73