diff options
author | Rémi Calixte <remicalixte.rmc@gmail.com> | 2021-07-27 21:50:22 +0200 |
---|---|---|
committer | Rémi Calixte <remicalixte.rmc@gmail.com> | 2021-07-27 21:50:22 +0200 |
commit | 6239e413783793c096ac91f1cab90ee9c9583ad1 (patch) | |
tree | f51d2e0428ee2ff597c6abce324cb27b2009ac66 /arm9/lib/NitroSDK/src/FX_vec.c | |
parent | 610a801e1793ae3242aee3855bceae30aff019f6 (diff) | |
parent | 0c2db8de60375ab8c450ea64320feb22431f43aa (diff) |
Merge branch 'master' into unk_02005CFC
Diffstat (limited to 'arm9/lib/NitroSDK/src/FX_vec.c')
-rw-r--r-- | arm9/lib/NitroSDK/src/FX_vec.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/arm9/lib/NitroSDK/src/FX_vec.c b/arm9/lib/NitroSDK/src/FX_vec.c index 005872ac..18d0939f 100644 --- a/arm9/lib/NitroSDK/src/FX_vec.c +++ b/arm9/lib/NitroSDK/src/FX_vec.c @@ -1,15 +1,14 @@ -#include "fx.h" - -#include "global.h" +#include "function_target.h" #include "registers.h" +#include "fx.h" -ARM_FUNC void VEC_Add(struct Vecx32 *a, struct Vecx32 *b, struct Vecx32 *dst){ +ARM_FUNC void VEC_Add(const struct Vecx32 *a, const struct Vecx32 *b, struct Vecx32 *dst){ dst->x = a->x + b->x; dst->y = a->y + b->y; dst->z = a->z + b->z; } -ARM_FUNC void VEC_Subtract(struct Vecx32 *a, struct Vecx32 *b, struct Vecx32 *dst){ +ARM_FUNC void VEC_Subtract(const struct Vecx32 *a, const struct Vecx32 *b, struct Vecx32 *dst){ dst->x = a->x - b->x; dst->y = a->y - b->y; dst->z = a->z - b->z; @@ -21,7 +20,7 @@ ARM_FUNC void VEC_Fx16Add(struct Vecx16 *a, struct Vecx16 *b, struct Vecx16 *dst dst->z = (s16)(a->z + b->z); } -ARM_FUNC fx32 VEC_DotProduct(struct Vecx32 *a, struct Vecx32 *b){ +ARM_FUNC fx32 VEC_DotProduct(const struct Vecx32 *a, const struct Vecx32 *b){ return (fx32)(((fx64)a->x * b->x + (fx64)a->y * b->y + (fx64)a->z * b->z + (1 << (FX64_INT_SHIFT - 1))) >> FX64_INT_SHIFT); } @@ -32,7 +31,7 @@ ARM_FUNC fx32 VEC_Fx16DotProduct(struct Vecx16 *a, struct Vecx16 *b){ return (fx32)(((fx64)temp1 + temp2) >> FX64_INT_SHIFT); } -ARM_FUNC void VEC_CrossProduct(struct Vecx32 *a, struct Vecx32 *b, struct Vecx32 *dst){ +ARM_FUNC void VEC_CrossProduct(const struct Vecx32 *a, const struct Vecx32 *b, struct Vecx32 *dst){ fx32 x, y, z; x = (fx32)(((fx64)a->y * b->z - (fx64)a->z * b->y + (1 << (FX64_INT_SHIFT - 1))) >> FX64_INT_SHIFT); y = (fx32)(((fx64)a->z * b->x - (fx64)a->x * b->z + (1 << (FX64_INT_SHIFT - 1))) >> FX64_INT_SHIFT); @@ -62,7 +61,7 @@ ARM_FUNC fx32 VEC_Mag(struct Vecx32 *a){ return ((fx32)reg_CP_SQRT_RESULT + 1) >> 1; } -ARM_FUNC void VEC_Normalize(struct Vecx32 *a, struct Vecx32 *dst){ +ARM_FUNC void VEC_Normalize(const struct Vecx32 *a, struct Vecx32 *dst){ fx64 l2 = (fx64)a->x * a->x; l2 += (fx64)a->y * a->y; l2 += (fx64)a->z * a->z; |