From a0af0bf58883b23af4b75d4111457c388bb3e9c9 Mon Sep 17 00:00:00 2001 From: Billy Robert O'Neal III Date: Mon, 13 Aug 2018 12:05:50 -0700 Subject: [PATCH] Workaround use of private constant _Snan no longer being present in . --- Source/Core/Common/FloatUtils.h | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Source/Core/Common/FloatUtils.h b/Source/Core/Common/FloatUtils.h index a841165b70..41b74b0d63 100644 --- a/Source/Core/Common/FloatUtils.h +++ b/Source/Core/Common/FloatUtils.h @@ -10,6 +10,18 @@ #include "Common/BitUtils.h" #include "Common/CommonTypes.h" +#ifdef _MSC_VER + +// MSVC needs a workaround, because its std::numeric_limits::signaling_NaN() +// will use __builtin_nans, which is improperly handled by the compiler and generates +// a bad constant. Here we go back to the version MSVC used before the builtin. +// TODO: Remove this and use numeric_limits directly whenever this bug is fixed. +// See Visual Studio bug # 128935 "std::numeric_limits::signaling_NaN() is broken" + +#include + +#endif // _MSC_VER + namespace Common { template @@ -20,10 +32,7 @@ constexpr T SNANConstant() #ifdef _MSC_VER -// MSVC needs a workaround, because its std::numeric_limits::signaling_NaN() -// will use __builtin_nans, which is improperly handled by the compiler and generates -// a bad constant. Here we go back to the version MSVC used before the builtin. -// TODO: Remove this and use numeric_limits directly whenever this bug is fixed. +// See workaround note above. template <> constexpr double SNANConstant() @@ -36,7 +45,7 @@ constexpr float SNANConstant() return (_CSTD _Snan._Float); } -#endif +#endif // _MSC_VER // The most significant bit of the fraction is an is-quiet bit on all architectures we care about. enum : u64