diff --git a/src/MSL/math.h b/src/MSL/math.h index e215ef53d2..5b5bb27afb 100644 --- a/src/MSL/math.h +++ b/src/MSL/math.h @@ -103,6 +103,24 @@ static inline f32 fabs_inline(f32 x) } } +inline float sqrtf_accurate(float x) +{ + volatile float y; + if (x > 0.0f) { + double guess = __frsqrte((double) x); // returns an approximation to + guess = + 0.5 * guess * (3.0 - guess * guess * x); // now have 12 sig bits + guess = + 0.5 * guess * (3.0 - guess * guess * x); // now have 24 sig bits + guess = + 0.5 * guess * (3.0 - guess * guess * x); // now have 32 sig bits + guess = 0.5 * guess * (3.0 - guess * guess * x); // extra iteration + y = (float) (x * guess); + return y; + } + return x; +} + double frexp(double x, int* exponent); double fabsf__Ff(double); float tanf(float x); diff --git a/src/MSL/trigf.h b/src/MSL/trigf.h index f22c761be1..081635a96a 100644 --- a/src/MSL/trigf.h +++ b/src/MSL/trigf.h @@ -3,8 +3,12 @@ #include -f32 tanf(f32); -f32 cosf(f32); -f32 sinf(f32); +float acosf(float); +float asinf(float); +float atan2f(float y, float x); +float atanf(float); +float cosf(float); +float sinf(float); +float tanf(float); #endif diff --git a/src/melee/it/items/itluigifireball.c b/src/melee/it/items/itluigifireball.c index a7a183235c..78c7f2386e 100644 --- a/src/melee/it/items/itluigifireball.c +++ b/src/melee/it/items/itluigifireball.c @@ -9,9 +9,9 @@ #include "it/it_2725.h" #include "it/itCommonItems.h" #include "it/item.h" -#include "lb/lbvector.h" #include +#include #include #include diff --git a/src/melee/lb/lbcollision.c b/src/melee/lb/lbcollision.c index a24e7d5405..2ac6d00d9e 100644 --- a/src/melee/lb/lbcollision.c +++ b/src/melee/lb/lbcollision.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include diff --git a/src/melee/lb/lbvector.h b/src/melee/lb/lbvector.h index bca1170f77..f1899d6484 100644 --- a/src/melee/lb/lbvector.h +++ b/src/melee/lb/lbvector.h @@ -44,24 +44,4 @@ Vec3* lbVector_WorldToScreen(HSD_CObj* cobj, const Vec3* pos3d, void lbVector_CreateEulerMatrix(Mtx m, Vec3* angles); float lbVector_8000E838(Vec3* a, Vec3* b, Vec3* c, Vec3* d); -/// @todo Doesn't belong here. -/// Exactly the same as the one from math.h, but with one extra iteration -static inline float sqrtf_accurate(float x) -{ - volatile float y; - if (x > 0.0f) { - double guess = __frsqrte((double) x); // returns an approximation to - guess = - 0.5 * guess * (3.0 - guess * guess * x); // now have 12 sig bits - guess = - 0.5 * guess * (3.0 - guess * guess * x); // now have 24 sig bits - guess = - 0.5 * guess * (3.0 - guess * guess * x); // now have 32 sig bits - guess = 0.5 * guess * (3.0 - guess * guess * x); // extra iteration - y = (float) (x * guess); - return y; - } - return x; -} - #endif diff --git a/src/sysdolphin/baselib/cobj.c b/src/sysdolphin/baselib/cobj.c index 37d118c67b..d43b93d884 100644 --- a/src/sysdolphin/baselib/cobj.c +++ b/src/sysdolphin/baselib/cobj.c @@ -6,7 +6,6 @@ #include "class.h" #include "debug.h" #include "displayfunc.h" -#include "fobj.h" #include "initialize.h" #include "mtx.h" #include "video.h" diff --git a/src/sysdolphin/baselib/jobj.c b/src/sysdolphin/baselib/jobj.c index 0cfb314ba0..18966498a2 100644 --- a/src/sysdolphin/baselib/jobj.c +++ b/src/sysdolphin/baselib/jobj.c @@ -15,6 +15,8 @@ #include "spline.h" #include <__mem.h> +#include +#include #include #include #include