Merge pull request #3383 from Sonicadvance1/compile_fixes
Compile fixes
This commit is contained in:
commit
be8410dcad
|
@ -5,6 +5,7 @@
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <unistd.h>
|
||||||
#include <asm/hwcap.h>
|
#include <asm/hwcap.h>
|
||||||
#include <sys/auxv.h>
|
#include <sys/auxv.h>
|
||||||
|
|
||||||
|
|
|
@ -196,6 +196,12 @@ const int fres_expected_dec[] =
|
||||||
// Used by fres and ps_res.
|
// Used by fres and ps_res.
|
||||||
double ApproximateReciprocal(double val)
|
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
|
union
|
||||||
{
|
{
|
||||||
double valf;
|
double valf;
|
||||||
|
@ -209,23 +215,23 @@ double ApproximateReciprocal(double val)
|
||||||
|
|
||||||
// Special case 0
|
// Special case 0
|
||||||
if (mantissa == 0 && exponent == 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
|
// Special case NaN-ish numbers
|
||||||
if (exponent == (0x7FFLL << 52))
|
if (exponent == (0x7FFLL << 52))
|
||||||
{
|
{
|
||||||
if (mantissa == 0)
|
if (mantissa == 0)
|
||||||
return std::copysign(0.0, valf);
|
return copysign(0.0, valf);
|
||||||
return 0.0 + valf;
|
return 0.0 + valf;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Special case small inputs
|
// Special case small inputs
|
||||||
if (exponent < (895LL << 52))
|
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
|
// Special case large inputs
|
||||||
if (exponent >= (1149LL << 52))
|
if (exponent >= (1149LL << 52))
|
||||||
return std::copysign(0.0, valf);
|
return copysign(0.0, valf);
|
||||||
|
|
||||||
exponent = (0x7FDLL << 52) - exponent;
|
exponent = (0x7FDLL << 52) - exponent;
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue