summaryrefslogtreecommitdiff
path: root/src/code
diff options
context:
space:
mode:
authorfig02 <fig02srl@gmail.com>2022-02-05 17:45:03 -0500
committerGitHub <noreply@github.com>2022-02-05 23:45:03 +0100
commitb41489c443943d273251b2497cac2ead2eea20ab (patch)
tree23d79ab2db3bc026b3c626c1341c02178a35208a /src/code
parentc8f4d66b009ad400f54538d6293afd5971c87776 (diff)
fix Math_GetAtan2Tbl (#1132)
Diffstat (limited to 'src/code')
-rw-r--r--src/code/sys_math_atan.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/code/sys_math_atan.c b/src/code/sys_math_atan.c
index 02f515327..21152c9f2 100644
--- a/src/code/sys_math_atan.c
+++ b/src/code/sys_math_atan.c
@@ -78,16 +78,20 @@ static u16 sATan2Tbl[] = {
};
u16 Math_GetAtan2Tbl(f32 x, f32 y) {
- s32 tblIdx = ((x / y) * 1024.0f) + 0.5f;
u16 ret;
if (y == 0.0f) {
ret = sATan2Tbl[0];
- } else if (tblIdx >= ARRAY_COUNT(sATan2Tbl)) {
- ret = sATan2Tbl[0];
} else {
- ret = sATan2Tbl[tblIdx];
+ s32 tblIdx = ((x / y) * 1024.0f) + 0.5f;
+
+ if (tblIdx >= ARRAY_COUNT(sATan2Tbl)) {
+ ret = sATan2Tbl[0];
+ } else {
+ ret = sATan2Tbl[tblIdx];
+ }
}
+
return ret;
}