From 18d658df1fd9602a3620fc8581462c6b54ae635d Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 21 Aug 2015 15:03:59 -0400 Subject: [PATCH 1/2] Interpreter_FloatingPoint: Use std::isnan instead of IsNAN Same thing, except one is part of the stdlib. --- .../Core/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp index 758718b3a1..d797766126 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp @@ -22,7 +22,7 @@ void Interpreter::Helper_FloatCompareOrdered(UGeckoInstruction _inst, double fa, { int compareResult; - if (IsNAN(fa) || IsNAN(fb)) + if (std::isnan(fa) || std::isnan(fb)) { FPSCR.FX = 1; compareResult = FPCC::FU; @@ -62,7 +62,7 @@ void Interpreter::Helper_FloatCompareUnordered(UGeckoInstruction _inst, double f { int compareResult; - if (IsNAN(fa) || IsNAN(fb)) + if (std::isnan(fa) || std::isnan(fb)) { compareResult = FPCC::FU; From caec42135d9b47881574625b341a6730820a2ff7 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 21 Aug 2015 15:05:11 -0400 Subject: [PATCH 2/2] MathUtil: Remove IsNAN and IsINF These aren't necessary, since the stdlib provides equivalents. --- Source/Core/Common/MathUtil.h | 13 ------------- Source/UnitTests/Common/MathUtilTest.cpp | 12 ------------ 2 files changed, 25 deletions(-) diff --git a/Source/Core/Common/MathUtil.h b/Source/Core/Common/MathUtil.h index 1efeca4066..c9bd3e09b4 100644 --- a/Source/Core/Common/MathUtil.h +++ b/Source/Core/Common/MathUtil.h @@ -56,19 +56,6 @@ union IntFloat { explicit IntFloat(float _f) : f(_f) {} }; -inline bool IsINF(double d) -{ - IntDouble x(d); - return (x.i & ~DOUBLE_SIGN) == DOUBLE_EXP; -} - -inline bool IsNAN(double d) -{ - IntDouble x(d); - return ((x.i & DOUBLE_EXP) == DOUBLE_EXP) && - ((x.i & DOUBLE_FRAC) != DOUBLE_ZERO); -} - inline bool IsQNAN(double d) { IntDouble x(d); diff --git a/Source/UnitTests/Common/MathUtilTest.cpp b/Source/UnitTests/Common/MathUtilTest.cpp index c5f2f20b65..f7427cc8c3 100644 --- a/Source/UnitTests/Common/MathUtilTest.cpp +++ b/Source/UnitTests/Common/MathUtilTest.cpp @@ -20,18 +20,6 @@ TEST(MathUtil, Clamp) EXPECT_EQ(0.0, MathUtil::Clamp(-1.0, 0.0, 2.0)); } -TEST(MathUtil, IsINF) -{ - EXPECT_TRUE(MathUtil::IsINF(+std::numeric_limits::infinity())); - EXPECT_TRUE(MathUtil::IsINF(-std::numeric_limits::infinity())); -} - -TEST(MathUtil, IsNAN) -{ - EXPECT_TRUE(MathUtil::IsNAN(std::numeric_limits::quiet_NaN())); - EXPECT_TRUE(MathUtil::IsNAN(std::numeric_limits::signaling_NaN())); -} - TEST(MathUtil, IsQNAN) { EXPECT_TRUE(MathUtil::IsQNAN(std::numeric_limits::quiet_NaN()));