summaryrefslogtreecommitdiff
path: root/Source/Core/Common/MathUtil.cpp
diff options
context:
space:
mode:
authorScott Mansell <phiren@gmail.com>2015-12-27 02:16:55 +1300
committerScott Mansell <phiren@gmail.com>2015-12-27 02:16:55 +1300
commitbe8410dcade41f4e1d69cbdbfc46dfce9635287f (patch)
treed81d815e325956887b4a931b9eebb142774ef5aa /Source/Core/Common/MathUtil.cpp
parent4ddc04da07eb90c36e6488495de3e4530695172f (diff)
parenteb2d4935cdd6085b374972ad0ad4930f368be8c8 (diff)
Merge pull request #3383 from Sonicadvance1/compile_fixes
Compile fixes
Diffstat (limited to 'Source/Core/Common/MathUtil.cpp')
-rw-r--r--Source/Core/Common/MathUtil.cpp14
1 files 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<double>::infinity(), valf);
+ return copysign(std::numeric_limits<double>::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<float>::max(), valf);
+ return copysign(std::numeric_limits<float>::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;