From d0ed3b81922fe1a6650853931b2a2b26b8d526c6 Mon Sep 17 00:00:00 2001 From: magumagu Date: Thu, 22 May 2014 19:20:43 -0700 Subject: [PATCH] Jit: Use infinity and NaN from numeric_limits. MSVC's implementation of INFINITY is unusable. --- .../PowerPC/Interpreter/Interpreter_FPUtils.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_FPUtils.h b/Source/Core/Core/PowerPC/Interpreter/Interpreter_FPUtils.h index c5d24f7a03..906913c423 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_FPUtils.h +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_FPUtils.h @@ -4,6 +4,8 @@ #pragma once +#include + #include "Common/CPUDetect.h" #include "Common/MathUtil.h" #include "Core/PowerPC/Interpreter/Interpreter.h" @@ -307,7 +309,8 @@ inline double ApproximateReciprocal(double val) // Special case 0 if (mantissa == 0 && exponent == 0) - return sign ? -INFINITY : INFINITY; + return sign ? -std::numeric_limits::infinity() : + std::numeric_limits::infinity(); // Special case NaN-ish numbers if (exponent == (0x7FFLL << 52)) { @@ -364,17 +367,22 @@ inline double ApproximateReciprocalSquareRoot(double val) // Special case 0 if (mantissa == 0 && exponent == 0) - return sign ? -INFINITY : INFINITY; + return sign ? -std::numeric_limits::infinity() : + std::numeric_limits::infinity(); // Special case NaN-ish numbers if (exponent == (0x7FFLL << 52)) { if (mantissa == 0) - return sign ? NAN : 0.0; + { + if (sign) + return std::numeric_limits::quiet_NaN(); + return 0.0; + } return 0.0 + valf; } // Negative numbers return NaN if (sign) - return NAN; + return std::numeric_limits::quiet_NaN(); if (!exponent) {