summaryrefslogtreecommitdiff
path: root/include/JSystem/JMath
diff options
context:
space:
mode:
authorCaroline Madsen <69010899+randomsalience@users.noreply.github.com>2024-10-23 19:25:13 -0400
committerGitHub <noreply@github.com>2024-10-24 02:25:13 +0300
commit5650c7fe0861609b4b2c6db09312622a1fcd7fc1 (patch)
tree16c6c124bc0c92edfc8a1f30d54276656087b0f8 /include/JSystem/JMath
parentc44ea2139d298e515f2a5208bf8847a88c15ecf1 (diff)
JAudio2 and Z2AudioLib work (#2223)
* JAudio2 and Z2AudioLib work * check1stDynamicWave matched
Diffstat (limited to 'include/JSystem/JMath')
-rw-r--r--include/JSystem/JMath/JMATrigonometric.h6
-rw-r--r--include/JSystem/JMath/JMath.h4
2 files changed, 7 insertions, 3 deletions
diff --git a/include/JSystem/JMath/JMATrigonometric.h b/include/JSystem/JMath/JMATrigonometric.h
index 89c4944773..2b162c56c5 100644
--- a/include/JSystem/JMath/JMATrigonometric.h
+++ b/include/JSystem/JMath/JMATrigonometric.h
@@ -39,16 +39,16 @@ struct TSinCosTable {
inline T sinDegree(T degree) {
if (degree < (T)0.0) {
- return -table[(u16)(((T)(1 << N) / 360.0) * degree) & ((1 << N) - 1)].first;
+ return -table[(u16)(-((T)(1 << N) / (T)360.0) * degree) & ((1 << N) - 1)].first;
}
- return table[(u16)(((T)(1 << N) / 360.0) * degree) & ((1 << N) - 1)].first;
+ return table[(u16)(((T)(1 << N) / (T)360.0) * degree) & ((1 << N) - 1)].first;
}
inline T cosDegree(T degree) {
if (degree < (T)0.0) {
degree = -degree;
}
- return table[(u16)(((T)(1 << N) / 360.0) * degree) & ((1 << N) - 1)].second;
+ return table[(u16)(((T)(1 << N) / (T)360.0) * degree) & ((1 << N) - 1)].second;
}
inline T sinRadian(T radian) {
diff --git a/include/JSystem/JMath/JMath.h b/include/JSystem/JMath/JMath.h
index 3363fd94e1..51f5ce78e8 100644
--- a/include/JSystem/JMath/JMath.h
+++ b/include/JSystem/JMath/JMath.h
@@ -8,6 +8,10 @@ void JMAEulerToQuat(s16 param_0, s16 param_1, s16 param_2, Quaternion* param_3);
void JMAQuatLerp(const Quaternion*, const Quaternion*, f32, Quaternion*);
void JMAFastVECNormalize(register const Vec* src, register Vec* dst);
+inline int JMAAbs(int value) {
+ return (value >> 0x1f ^ value) - (value >> 0x1f);
+}
+
inline f32 JMAFastReciprocal(f32 value) {
return __fres(value);
}