PxSimpleTypes.h
Go to the documentation of this file.
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 
15 #ifndef PX_FOUNDATION_PX_SIMPLE_TYPES_H
16 #define PX_FOUNDATION_PX_SIMPLE_TYPES_H
17 
22 // Platform specific types:
23 //Design note: Its OK to use int for general loop variables and temps.
24 
26 #include "foundation/Px.h"
27 #ifndef PX_DOXYGEN
28 namespace physx
29 {
30 #endif
31 #if defined (PX_WINDOWS) || defined(PX_WINMODERN) || defined (DOXYGEN) || defined(PX_XBOXONE)
32 
33  typedef signed __int64 PxI64;
34  typedef signed int PxI32;
35  typedef signed short PxI16;
36  typedef signed char PxI8;
37 
38  typedef unsigned __int64 PxU64;
39  typedef unsigned int PxU32;
40  typedef unsigned short PxU16;
41  typedef unsigned char PxU8;
42 
43  typedef float PxF32;
44  typedef double PxF64;
45 
46 #elif defined(PX_LINUX) || defined(PX_ANDROID)
47  typedef signed long long PxI64;
48  typedef signed int PxI32;
49  typedef signed short PxI16;
50  typedef signed char PxI8;
51 
52  typedef unsigned long long PxU64;
53  typedef unsigned int PxU32;
54  typedef unsigned short PxU16;
55  typedef unsigned char PxU8;
56 
57  typedef float PxF32;
58  typedef double PxF64;
59 
60 #elif defined(PX_APPLE)
61  typedef signed long long PxI64;
62  typedef signed int PxI32;
63  typedef signed short PxI16;
64  typedef signed char PxI8;
65 
66  typedef unsigned long long PxU64;
67  typedef unsigned int PxU32;
68  typedef unsigned short PxU16;
69  typedef unsigned char PxU8;
70 
71  typedef float PxF32;
72  typedef double PxF64;
73 
74 #elif defined(PX_PS3)
75  typedef signed long long PxI64;
76  typedef signed int PxI32;
77  typedef signed short PxI16;
78  typedef signed char PxI8;
79 
80  typedef unsigned long long PxU64;
81  typedef unsigned int PxU32;
82  typedef unsigned short PxU16;
83  typedef unsigned char PxU8;
84 
85  typedef float PxF32;
86  typedef double PxF64;
87 
88 #elif defined(PX_PSP2)
89  typedef signed long long PxI64;
90  typedef signed int PxI32;
91  typedef signed short PxI16;
92  typedef signed char PxI8;
93 
94  typedef unsigned long long PxU64;
95  typedef unsigned int PxU32;
96  typedef unsigned short PxU16;
97  typedef unsigned char PxU8;
98 
99  typedef float PxF32;
100  typedef double PxF64;
101 
102 #elif defined(PX_X360)
103  typedef signed __int64 PxI64;
104  typedef signed int PxI32;
105  typedef signed short PxI16;
106  typedef signed char PxI8;
107 
108  typedef unsigned __int64 PxU64;
109  typedef unsigned int PxU32;
110  typedef unsigned short PxU16;
111  typedef unsigned char PxU8;
112 
113  typedef float PxF32;
114  typedef double PxF64;
115 
116 #elif defined(PX_WIIU)
117  typedef signed long long PxI64;
118  typedef signed int PxI32;
119  typedef signed short PxI16;
120  typedef signed char PxI8;
121 
122  typedef unsigned long long PxU64;
123  typedef unsigned int PxU32;
124  typedef unsigned short PxU16;
125  typedef unsigned char PxU8;
126 
127  typedef float PxF32;
128  typedef double PxF64;
129 
130 #elif defined(PX_PS4)
131  typedef signed long long PxI64;
132  typedef signed int PxI32;
133  typedef signed short PxI16;
134  typedef signed char PxI8;
135 
136  typedef unsigned long long PxU64;
137  typedef unsigned int PxU32;
138  typedef unsigned short PxU16;
139  typedef unsigned char PxU8;
140 
141  typedef float PxF32;
142  typedef double PxF64;
143 
144 #else
145  #error Unknown platform!
146 
147 #endif
148 
149  PX_COMPILE_TIME_ASSERT(sizeof(PxI8)==1);
150  PX_COMPILE_TIME_ASSERT(sizeof(PxU8)==1);
151  PX_COMPILE_TIME_ASSERT(sizeof(PxI16)==2);
152  PX_COMPILE_TIME_ASSERT(sizeof(PxU16)==2);
153  PX_COMPILE_TIME_ASSERT(sizeof(PxI32)==4);
154  PX_COMPILE_TIME_ASSERT(sizeof(PxU32)==4);
155  PX_COMPILE_TIME_ASSERT(sizeof(PxI64)==8);
156  PX_COMPILE_TIME_ASSERT(sizeof(PxU64)==8);
157 
158  // Type ranges
159 #define PX_MAX_I8 127 //maximum possible sbyte value, 0x7f
160 #define PX_MIN_I8 (-128) //minimum possible sbyte value, 0x80
161 #define PX_MAX_U8 255U //maximum possible ubyte value, 0xff
162 #define PX_MIN_U8 0 //minimum possible ubyte value, 0x00
163 #define PX_MAX_I16 32767 //maximum possible sword value, 0x7fff
164 #define PX_MIN_I16 (-32768) //minimum possible sword value, 0x8000
165 #define PX_MAX_U16 65535U //maximum possible uword value, 0xffff
166 #define PX_MIN_U16 0 //minimum possible uword value, 0x0000
167 #define PX_MAX_I32 2147483647 //maximum possible sdword value, 0x7fffffff
168 #define PX_MIN_I32 (-2147483647 - 1) //minimum possible sdword value, 0x80000000
169 #define PX_MAX_U32 4294967295U //maximum possible udword value, 0xffffffff
170 #define PX_MIN_U32 0 //minimum possible udword value, 0x00000000
171 #define PX_MAX_F32 3.4028234663852885981170418348452e+38F
172  //maximum possible float value
173 #define PX_MAX_F64 DBL_MAX //maximum possible double value
174 
175 #define PX_EPS_F32 FLT_EPSILON //maximum relative error of float rounding
176 #define PX_EPS_F64 DBL_EPSILON //maximum relative error of double rounding
177 
178 #ifndef PX_FOUNDATION_USE_F64
179 
180  typedef PxF32 PxReal;
181 
182  #define PX_MAX_REAL PX_MAX_F32
183  #define PX_EPS_REAL PX_EPS_F32
184  #define PX_NORMALIZATION_EPSILON PxReal(1e-20f)
185 
186 #else
187 
188  typedef PxF64 PxReal;
189 
190  #define PX_MAX_REAL PX_MAX_F64
191  #define PX_EPS_REAL PX_EPS_F64
192  #define PX_NORMALIZATION_EPSILON PxReal(1e-180)
193 
194 #endif
195 
196 #ifndef PX_DOXYGEN
197 } // namespace physx
198 #endif
199 
201 #endif // PX_FOUNDATION_PX_SIMPLE_TYPES_H


Copyright © 2008-2015 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com