summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorPierre Bourdon <delroth@gmail.com>2018-08-13 21:56:55 +0200
committerGitHub <noreply@github.com>2018-08-13 21:56:55 +0200
commit60f12e1d4c868a13723cb6568b04374ebc73b5f7 (patch)
treee0dc9be51292ba35b5f3e8425fdf604d254d922c /Source
parent3f96f96f142703858302d054120aabbc4426c921 (diff)
parent6640d1ec81766faa9ba26f684a2762e7b24b25cb (diff)
Merge pull request #7327 from BillyONeal/master
Workaround use of private constant _Snan no longer being present in <limits>
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/Common/FloatUtils.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/Source/Core/Common/FloatUtils.h b/Source/Core/Common/FloatUtils.h
index a841165b70..d7657b941a 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<double>::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<float>::signaling_NaN() is broken"
+
+#include <ymath.h>
+
+#endif // _MSC_VER
+
namespace Common
{
template <typename T>
@@ -20,10 +32,7 @@ constexpr T SNANConstant()
#ifdef _MSC_VER
-// MSVC needs a workaround, because its std::numeric_limits<double>::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