Skip to content

Commit 664ddca

Browse files
committed
ODE: dInfinity is real infinity on x64 now
Removed previous code
1 parent bc83958 commit 664ddca

File tree

2 files changed

+21
-32
lines changed

2 files changed

+21
-32
lines changed

Externals/ode/include/ode/config.h

Lines changed: 20 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -58,40 +58,29 @@ extern "C" {
5858

5959
#include <math.h>
6060

61-
62-
63-
#if defined(WIN32) && (defined(MSVC) || defined(MINGW))
64-
65-
static union { unsigned char __c[4]; float __f; } __ode_huge_valf =
66-
67-
{{0,0,0x80,0x7f}};
68-
69-
#define _INFINITY4 (__ode_huge_valf.__f)
70-
71-
static union { unsigned char __c[8]; double __d; } __ode_huge_val =
72-
73-
{{0,0,0,0,0,0,0xf0,0x7f }};
74-
75-
#define _INFINITY8 (__ode_huge_val.__d)
76-
61+
/* Define the dInfinity macro */
62+
#ifdef INFINITY
63+
#ifdef dSINGLE
64+
#define dInfinity ((float)INFINITY)
7765
#else
78-
79-
#define _INFINITY8 HUGE_VAL
80-
81-
#define _INFINITY4 HUGE_VALF
82-
66+
#define dInfinity ((double)INFINITY)
8367
#endif
84-
85-
86-
87-
#if defined(dSINGLE)
88-
89-
#define dInfinity _INFINITY4
90-
68+
#elif defined(HUGE_VAL)
69+
#ifdef dSINGLE
70+
#ifdef HUGE_VALF
71+
#define dInfinity HUGE_VALF
9172
#else
92-
93-
#define dInfinity _INFINITY8
94-
73+
#define dInfinity ((float)HUGE_VAL)
74+
#endif
75+
#else
76+
#define dInfinity HUGE_VAL
77+
#endif
78+
#else
79+
#ifdef dSINGLE
80+
#define dInfinity ((float)(1.0/0.0))
81+
#else
82+
#define dInfinity (1.0/0.0)
83+
#endif
9584
#endif
9685

9786

src/xrPhysics/Physics.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ IC static int CollideIntoGroup(
248248
}
249249

250250
if (pushing_neg)
251-
surface.mu = std::numeric_limits<dReal>::infinity();
251+
surface.mu = dInfinity;
252252

253253
if (do_collide && collided_contacts < MAX_CONTACTS)
254254
{

0 commit comments

Comments
 (0)