From eaf21b3c8038e209aea7a12bacc0963db487118c Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Tue, 22 Dec 2015 18:20:17 -0600 Subject: [PATCH 1/2] Work around Google's trash NDK --- Source/Core/Common/MathUtil.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Source/Core/Common/MathUtil.cpp b/Source/Core/Common/MathUtil.cpp index a9252ddf55..b2f8714698 100644 --- a/Source/Core/Common/MathUtil.cpp +++ b/Source/Core/Common/MathUtil.cpp @@ -196,6 +196,12 @@ const int fres_expected_dec[] = // Used by fres and ps_res. double ApproximateReciprocal(double val) { + // We are using namespace std scoped here because the Android NDK is complete trash as usual + // For 32bit targets(mips, ARMv7, x86) it doesn't provide an implementation of std::copysign + // but instead provides just global namespace copysign implementations. + // The workaround for this is to just use namespace std within this function's scope + // That way on real toolchains it will use the std:: variant like normal. + using namespace std; union { double valf; @@ -209,23 +215,23 @@ double ApproximateReciprocal(double val) // Special case 0 if (mantissa == 0 && exponent == 0) - return std::copysign(std::numeric_limits::infinity(), valf); + return copysign(std::numeric_limits::infinity(), valf); // Special case NaN-ish numbers if (exponent == (0x7FFLL << 52)) { if (mantissa == 0) - return std::copysign(0.0, valf); + return copysign(0.0, valf); return 0.0 + valf; } // Special case small inputs if (exponent < (895LL << 52)) - return std::copysign(std::numeric_limits::max(), valf); + return copysign(std::numeric_limits::max(), valf); // Special case large inputs if (exponent >= (1149LL << 52)) - return std::copysign(0.0, valf); + return copysign(0.0, valf); exponent = (0x7FDLL << 52) - exponent; From eb2d4935cdd6085b374972ad0ad4930f368be8c8 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Tue, 22 Dec 2015 18:20:48 -0600 Subject: [PATCH 2/2] Including missing headers required for non-pch builds and other architectures --- Source/Core/Common/ArmCPUDetect.cpp | 1 + Source/Core/Common/NandPaths.cpp | 1 + Source/Core/Common/Network.cpp | 1 + 3 files changed, 3 insertions(+) diff --git a/Source/Core/Common/ArmCPUDetect.cpp b/Source/Core/Common/ArmCPUDetect.cpp index e971fde2a4..4e68054410 100644 --- a/Source/Core/Common/ArmCPUDetect.cpp +++ b/Source/Core/Common/ArmCPUDetect.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include diff --git a/Source/Core/Common/NandPaths.cpp b/Source/Core/Common/NandPaths.cpp index 4048979c3c..25488ef410 100644 --- a/Source/Core/Common/NandPaths.cpp +++ b/Source/Core/Common/NandPaths.cpp @@ -4,6 +4,7 @@ #include #include +#include #include #include diff --git a/Source/Core/Common/Network.cpp b/Source/Core/Common/Network.cpp index 5d3ab7a9fb..23c570045f 100644 --- a/Source/Core/Common/Network.cpp +++ b/Source/Core/Common/Network.cpp @@ -3,6 +3,7 @@ // Refer to the license.txt file included. #include +#include #include #include