diff --git a/common/math/math.h b/common/math/math.h index 5af0691a2..1982c27c1 100644 --- a/common/math/math.h +++ b/common/math/math.h @@ -13,7 +13,7 @@ #include #if defined(__WIN32__) -#if (__MSV_VER <= 1700) +#if defined(_MSC_VER) && (_MSC_VER <= 1700) namespace std { __forceinline bool isinf ( const float x ) { return _finite(x) == 0; } @@ -86,7 +86,7 @@ return _mm_cvtss_f32(c); } -#if defined(__WIN32__) && (__MSC_VER <= 1700) +#if defined(__WIN32__) && defined(_MSC_VER) && (_MSC_VER <= 1700) __forceinline float nextafter(float x, float y) { if ((x0)) return x*(1.1f+float(ulp)); else return x*(0.9f-float(ulp)); } __forceinline double nextafter(double x, double y) { return _nextafter(x, y); } __forceinline int roundf(float f) { return (int)(f + 0.5f); } diff --git a/common/sys/intrinsics.h b/common/sys/intrinsics.h index 3f0619cac..58f5c3bb4 100644 --- a/common/sys/intrinsics.h +++ b/common/sys/intrinsics.h @@ -11,6 +11,12 @@ #include +// -- GODOT start -- +#if defined(__WIN32__) && defined(__MINGW32__) +#include +#endif +// -- GODOT end -- + #if defined(__BMI__) && defined(__GNUC__) && !defined(__INTEL_COMPILER) #if !defined(_tzcnt_u32) #define _tzcnt_u32 __tzcnt_u32 @@ -30,8 +36,14 @@ #endif #if defined(__WIN32__) -# define NOMINMAX -# include +// -- GODOT start -- +#if !defined(NOMINMAX) +// -- GODOT end -- +#define NOMINMAX +// -- GODOT start -- +#endif +#include "windows.h" +// -- GODOT end -- #endif /* normally defined in pmmintrin.h, but we always need this */ @@ -413,8 +425,16 @@ namespace embree __forceinline void pause_cpu(const size_t N = 8) { +// -- GODOT start -- for (size_t i=0; i