From aefa11b6adf3bdd0e82d2c2f125d2bd62288e246 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 29 Jun 2017 09:57:19 -0700 Subject: [PATCH] Workaround for MSVC not liking 1.0f/0.0f for float infinity --- common/math_defs.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/math_defs.h b/common/math_defs.h index 8756488c..1b394976 100644 --- a/common/math_defs.h +++ b/common/math_defs.h @@ -15,7 +15,11 @@ #endif #ifndef HUGE_VALF -#define HUGE_VALF (1.0f/0.0f) +static const union msvc_inf_hack { + unsigned char b[4]; + float f; +} msvc_inf_union = {{ 0x00, 0x00, 0x80, 0x7F }}; +#define HUGE_VALF (msvc_inf_union.f) #endif #define DEG2RAD(x) ((float)(x) * (F_PI/180.0f)) -- 2.11.4.GIT