]> git.xonotic.org Git - xonotic/xonotic.git/blob - misc/builddeps/linux64/ode/include/ode/odeconfig.h
1a0c7476a5e8c5c7217c400d4c57497edd6fe6c9
[xonotic/xonotic.git] / misc / builddeps / linux64 / ode / include / ode / odeconfig.h
1 /*************************************************************************
2  *                                                                       *
3  * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith.       *
4  * All rights reserved.  Email: russ@q12.org   Web: www.q12.org          *
5  *                                                                       *
6  * This library is free software; you can redistribute it and/or         *
7  * modify it under the terms of EITHER:                                  *
8  *   (1) The GNU Lesser General Public License as published by the Free  *
9  *       Software Foundation; either version 2.1 of the License, or (at  *
10  *       your option) any later version. The text of the GNU Lesser      *
11  *       General Public License is included with this library in the     *
12  *       file LICENSE.TXT.                                               *
13  *   (2) The BSD-style license that is included with this library in     *
14  *       the file LICENSE-BSD.TXT.                                       *
15  *                                                                       *
16  * This library is distributed in the hope that it will be useful,       *
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files    *
19  * LICENSE.TXT and LICENSE-BSD.TXT for more details.                     *
20  *                                                                       *
21  *************************************************************************/
22
23 #ifndef _ODE_ODECONFIG_H_
24 #define _ODE_ODECONFIG_H_
25
26 /* Pull in the standard headers */
27 #include <stddef.h>
28 #include <limits.h>
29 #include <stdio.h>
30 #include <stdlib.h>
31 #include <stdarg.h>
32 #include <math.h>
33 #include <string.h>
34 #include <float.h>
35
36
37 #include <ode/precision.h>
38
39
40 #if defined(ODE_DLL) || defined(ODE_LIB)
41 #define __ODE__
42 #endif
43
44 /* Define a DLL export symbol for those platforms that need it */
45 #if defined(_MSC_VER) || (defined(__GNUC__) && defined(_WIN32))
46   #if defined(ODE_DLL)
47     #define ODE_API __declspec(dllexport)
48   #else
49     #define ODE_API
50   #endif
51 #endif
52
53 #if !defined(ODE_API)
54   #define ODE_API
55 #endif
56
57 #if defined(_MSC_VER)
58 #  define ODE_API_DEPRECATED __declspec(deprecated)
59 #elif defined (__GNUC__) && ( (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)) )
60 #  define ODE_API_DEPRECATED __attribute__((__deprecated__))
61 #else
62 #  define ODE_API_DEPRECATED
63 #endif
64
65 #define ODE_PURE_INLINE static __inline
66 #define ODE_INLINE __inline
67
68 #if defined(__cplusplus)
69   #define ODE_EXTERN_C extern "C"
70 #else
71   #define ODE_EXTERN_C
72 #endif
73
74 #if defined(__GNUC__)
75 #define ODE_NORETURN __attribute__((noreturn))
76 #elif defined(_MSC_VER)
77 #define ODE_NORETURN __declspec(noreturn)
78 #else // #if !defined(_MSC_VER)
79 #define ODE_NORETURN
80 #endif // #if !defined(__GNUC__)
81
82
83 /* Well-defined common data types...need to be defined for 64 bit systems */
84 #if defined(__aarch64__) || defined(__alpha__) || defined(__ppc64__) \
85     || defined(__s390__) || defined(__s390x__) || defined(__zarch__) \
86     || defined(__mips__) || defined(__powerpc64__) || defined(__riscv) \
87     || (defined(__sparc__) && defined(__arch64__))
88     #include <stdint.h>
89     typedef int64_t         dint64;
90     typedef uint64_t        duint64;
91     typedef int32_t         dint32;
92     typedef uint32_t        duint32;
93     typedef int16_t         dint16;
94     typedef uint16_t        duint16;
95     typedef int8_t          dint8;
96     typedef uint8_t         duint8;
97
98     typedef intptr_t        dintptr;
99     typedef uintptr_t       duintptr;
100     typedef ptrdiff_t       ddiffint;
101     typedef size_t          dsizeint;
102
103 #elif (defined(_M_IA64) || defined(__ia64__) || defined(_M_AMD64) || defined(__x86_64__)) && !defined(__ILP32__) && !defined(_ILP32)
104   #define X86_64_SYSTEM   1
105 #if defined(_MSC_VER)
106   typedef __int64         dint64;
107   typedef unsigned __int64 duint64;
108 #else
109 #if defined(_LP64) || defined(__LP64__)
110 typedef long              dint64;
111 typedef unsigned long     duint64;
112 #else
113   typedef long long       dint64;
114   typedef unsigned long long duint64;
115 #endif
116 #endif
117   typedef int             dint32;
118   typedef unsigned int    duint32;
119   typedef short           dint16;
120   typedef unsigned short  duint16;
121   typedef signed char     dint8;
122   typedef unsigned char   duint8;
123
124   typedef dint64          dintptr;
125   typedef duint64         duintptr;
126   typedef dint64          ddiffint;
127   typedef duint64         dsizeint;
128
129 #else
130 #if defined(_MSC_VER)
131   typedef __int64         dint64;
132   typedef unsigned __int64 duint64;
133 #else
134   typedef long long       dint64;
135   typedef unsigned long long duint64;
136 #endif
137   typedef int             dint32;
138   typedef unsigned int    duint32;
139   typedef short           dint16;
140   typedef unsigned short  duint16;
141   typedef signed char     dint8;
142   typedef unsigned char   duint8;
143
144   typedef dint32          dintptr;
145   typedef duint32         duintptr;
146   typedef dint32          ddiffint;
147   typedef duint32         dsizeint;
148
149 #endif
150
151
152 /* Define the dInfinity macro */
153 #ifdef INFINITY
154   #ifdef dSINGLE
155     #define dInfinity ((float)INFINITY)
156   #else
157     #define dInfinity ((double)INFINITY)
158   #endif
159 #elif defined(HUGE_VAL)
160   #ifdef dSINGLE
161     #ifdef HUGE_VALF
162       #define dInfinity HUGE_VALF
163     #else
164       #define dInfinity ((float)HUGE_VAL)
165     #endif
166   #else
167     #define dInfinity HUGE_VAL
168   #endif
169 #else
170   #ifdef dSINGLE
171     #define dInfinity ((float)(1.0/0.0))
172   #else
173     #define dInfinity (1.0/0.0)
174   #endif
175 #endif
176
177
178 /* Define the dNaN macro */
179 #if defined(NAN)
180   #define dNaN NAN
181 #elif defined(__GNUC__)
182   #define dNaN ({ union { duint32 m_ui; float m_f; } un; un.m_ui = 0x7FC00000; un.m_f; })
183 #elif defined(__cplusplus)
184   union _dNaNUnion
185   {
186       _dNaNUnion(): m_ui(0x7FC00000) {}
187       duint32 m_ui; 
188       float m_f;
189   };
190   #define dNaN (_dNaNUnion().m_f)
191 #else
192   #ifdef dSINGLE
193     #define dNaN ((float)(dInfinity - dInfinity))
194   #else
195     #define dNaN (dInfinity - dInfinity)
196   #endif
197 #endif
198
199
200   /* Visual C does not define these functions */
201 #if defined(_MSC_VER)
202   #define _ode_copysignf(x, y) ((float)_copysign(x, y))
203   #define _ode_copysign(x, y) _copysign(x, y)
204   #define _ode_nextafterf(x, y) _nextafterf(x, y)
205   #define _ode_nextafter(x, y) _nextafter(x, y)
206   #if !defined(_WIN64) && defined(dSINGLE)
207     #define _ODE__NEXTAFTERF_REQUIRED
208     ODE_EXTERN_C float _nextafterf(float x, float y);
209   #endif
210 #else
211   #define _ode_copysignf(x, y) copysignf(x, y)
212   #define _ode_copysign(x, y) copysign(x, y)
213   #define _ode_nextafterf(x, y) nextafterf(x, y)
214   #define _ode_nextafter(x, y) nextafter(x, y)
215 #endif
216
217
218 #endif