Files
tp/include/JSystem/JMath/JMath.h
T

45 lines
836 B
C++
Raw Normal View History

2021-03-28 22:49:05 +02:00
#ifndef JMATH_H
#define JMATH_H
2021-10-11 09:38:53 -07:00
#include "dolphin/mtx/mtx.h"
#include "dolphin/types.h"
2021-10-11 09:38:53 -07:00
void JMAMTXApplyScale(const Mtx, Mtx, f32, f32, f32);
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;
}
inline f32 JMAFastSqrt(register f32 input) {
2021-11-10 23:54:31 -08:00
if (input > 0.0f) {
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 */