2021-03-28 22:49:05 +02:00
|
|
|
#ifndef JMATH_H
|
|
|
|
|
#define JMATH_H
|
2021-02-13 01:47:46 +01:00
|
|
|
|
2021-10-11 09:38:53 -07:00
|
|
|
#include "dolphin/mtx/mtx.h"
|
2021-02-13 01:47:46 +01:00
|
|
|
#include "dolphin/types.h"
|
|
|
|
|
|
2021-10-11 09:38:53 -07:00
|
|
|
void JMAMTXApplyScale(const Mtx, Mtx, f32, f32, f32);
|
2022-10-03 15:26:26 -07:00
|
|
|
void JMAEulerToQuat(s16 param_0, s16 param_1, s16 param_2, Quaternion* param_3);
|
2021-10-11 09:38:53 -07:00
|
|
|
|
|
|
|
|
inline f32 JMAFastReciprocal(f32 value) {
|
|
|
|
|
return __fres(value);
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-19 11:06:32 -08:00
|
|
|
inline float __frsqrtes(register double f) {
|
|
|
|
|
register float out;
|
|
|
|
|
// clang-format off
|
|
|
|
|
asm {
|
|
|
|
|
frsqrte out, f
|
|
|
|
|
}
|
|
|
|
|
// clang-format on
|
|
|
|
|
return out;
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-14 15:27:46 -07:00
|
|
|
inline f32 JMAFastSqrt(register f32 input) {
|
2021-11-10 23:54:31 -08:00
|
|
|
if (input > 0.0f) {
|
2023-03-14 15:27:46 -07:00
|
|
|
register f32 out;
|
|
|
|
|
asm {
|
|
|
|
|
frsqrte out, input
|
|
|
|
|
}
|
|
|
|
|
return out * input;
|
|
|
|
|
} else {
|
|
|
|
|
return input;
|
2021-11-10 23:54:31 -08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-11 09:38:53 -07:00
|
|
|
namespace JMath {
|
|
|
|
|
|
|
|
|
|
inline f32 fastReciprocal(f32 value) {
|
|
|
|
|
return JMAFastReciprocal(value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}; // namespace JMath
|
|
|
|
|
|
2021-03-28 22:49:05 +02:00
|
|
|
#endif /* JMATH_H */
|