diff options
| author | hatal175 <hatal175@users.noreply.github.com> | 2023-08-30 02:43:28 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-29 17:43:28 -0600 |
| commit | 4c5c3a8964dbf5f95f5599ae94bb87aa857931c0 (patch) | |
| tree | b8e83c867f02d262de9c94b668e5b158680ab008 /include/JSystem/JMath | |
| parent | 6a4e50e74b9823329889c509e6e548ccdd18844d (diff) | |
c_m3d, c_request OK. Work on Z2Audience (#1900)
Diffstat (limited to 'include/JSystem/JMath')
| -rw-r--r-- | include/JSystem/JMath/JMATrigonometric.h | 22 | ||||
| -rw-r--r-- | include/JSystem/JMath/JMath.h | 23 |
2 files changed, 45 insertions, 0 deletions
diff --git a/include/JSystem/JMath/JMATrigonometric.h b/include/JSystem/JMath/JMATrigonometric.h index 2b09c3939d..6fe4c32169 100644 --- a/include/JSystem/JMath/JMATrigonometric.h +++ b/include/JSystem/JMath/JMATrigonometric.h @@ -16,6 +16,20 @@ struct TSinCosTable { } return table[(u16)(8192.0f * v) & 0x1fff].first; } + + inline f32 sinDegree(f32 degree) { + if (degree < 0.0f) { + return -table[(u16)(-22.755556106567383f * degree) & 0x1fffU].first; + } + return table[(u16)(22.755556106567383f * degree) & 0x1fffU].first; + } + + inline f32 cosDegree(f32 degree) { + if (degree < 0.0f) { + degree = -degree; + } + return table[(u16)(22.755556106567383f * degree) & 0x1fffU].second; + } }; struct TAtanTable { @@ -52,4 +66,12 @@ inline f32 JMASinLap(f32 v) { return JMath::sincosTable_.sinLap(v); } +inline f32 JMASinDegree(f32 degree) { + return JMath::sincosTable_.sinDegree(degree); +} + +inline f32 JMACosDegree(f32 degree) { + return JMath::sincosTable_.cosDegree(degree); +} + #endif /* JMATRIGONOMETRIC_H */ diff --git a/include/JSystem/JMath/JMath.h b/include/JSystem/JMath/JMath.h index f22eeaf2e4..a6978cdb05 100644 --- a/include/JSystem/JMath/JMath.h +++ b/include/JSystem/JMath/JMath.h @@ -38,6 +38,29 @@ inline f32 fastReciprocal(f32 value) { return JMAFastReciprocal(value); } +inline void gekko_ps_copy12(register f32* dst, register const f32* src) { + register f32 src0; + register f32 src1; + register f32 src2; + register f32 src3; + register f32 src4; + register f32 src5; + asm { + psq_l src0, 0(src), 0, 0 + psq_l src1, 8(src), 0, 0 + psq_l src2, 16(src), 0, 0 + psq_l src3, 24(src), 0, 0 + psq_l src4, 32(src), 0, 0 + psq_l src5, 40(src), 0, 0 + psq_st src0, 0(dst), 0, 0 + psq_st src1, 8(dst), 0, 0 + psq_st src2, 16(dst), 0, 0 + psq_st src3, 24(dst), 0, 0 + psq_st src4, 32(dst), 0, 0 + psq_st src5, 40(dst), 0, 0 + }; +} + }; // namespace JMath #endif /* JMATH_H */ |
