diff options
author | GriffinR <griffin.g.richards@gmail.com> | 2021-05-27 06:46:29 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-27 06:46:29 -0400 |
commit | c396aaa804543c6950bdef918f3773394da09bdf (patch) | |
tree | a925bd32e0745ddf3ecef23d1ef3e710f3250273 /include/math_util.h | |
parent | 3dce3407d5f9bca69d61b1cf1b314fb1e921d572 (diff) | |
parent | 1a9ba7bb0aeb27a7d0bca43190edd054e517f27b (diff) |
Merge pull request #431 from PikalaxALT/sync_bery_crush
Sync berry crush from Emerald
Diffstat (limited to 'include/math_util.h')
-rw-r--r-- | include/math_util.h | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/include/math_util.h b/include/math_util.h index 9f9677463..1f8edc5d9 100644 --- a/include/math_util.h +++ b/include/math_util.h @@ -1,11 +1,21 @@ #ifndef GUARD_MATH_UTIL_H #define GUARD_MATH_UTIL_H -s16 MathUtil_Inv16(s16 y); -s16 MathUtil_Mul16(s16 x, s16 y); -s32 MathUtil_Div32(s32 x, s32 y); -s32 MathUtil_Mul32(s32 x, s32 y); -s16 MathUtil_Div16Shift(u8 s, s16 x, s16 y); -s16 MathUtil_Mul16Shift(u8 s, s16 x, s16 y); +// Fixed-point arithmetic library. + +// x * y +s16 Q_8_8_mul(s16 x, s16 y); +s16 Q_N_S_mul(u8 s, s16 x, s16 y); +s32 Q_24_8_mul(s32 x, s32 y); + +// x / y +s16 Q_8_8_div(s16 x, s16 y); +s16 Q_N_S_div(u8 s, s16 x, s16 y); +s32 Q_24_8_div(s32 x, s32 y); + +// 1.0 / y +s16 Q_8_8_inv(s16 y); +s16 Q_N_S_inv(u8 s, s16 y); +s32 Q_24_8_inv(s32 y); #endif //GUARD_MATH_UTIL_H |