mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2026-04-25 19:42:20 +00:00
* Update math_util.h to fix issues in last PR * Update math_util.h again
This commit is contained in:
parent
831fdcefc9
commit
74e344bef6
1 changed files with 13 additions and 9 deletions
|
|
@ -42,20 +42,24 @@ s16 sqr(s16 x);
|
|||
f32 sins(s16 sm64Angle);
|
||||
f32 coss(s16 sm64Angle);
|
||||
|
||||
// Generic macros help the inline functions be noted in autodoc while retaining original functionality
|
||||
#define min(a, b) _Generic((a), \
|
||||
f32: minf, \
|
||||
default: min \
|
||||
)(a, b)
|
||||
f32: minf(a, b), \
|
||||
s16: (min)(a, b), \
|
||||
default: ((a) < (b) ? (a) : (b)) \
|
||||
)
|
||||
|
||||
#define max(a, b) _Generic((a), \
|
||||
f32: maxf, \
|
||||
default: max \
|
||||
)(a, b)
|
||||
f32: maxf(a, b), \
|
||||
s16: (max)(a, b), \
|
||||
default: ((a) > (b) ? (a) : (b)) \
|
||||
)
|
||||
|
||||
#define sqr(x) _Generic((x), \
|
||||
f32: sqrf, \
|
||||
default: sqr \
|
||||
)(x)
|
||||
f32: sqrf(x), \
|
||||
s16: (sqr)(x), \
|
||||
default: ((x) * (x)) \
|
||||
)
|
||||
|
||||
#if defined(__clang__) || defined(__GNUC__)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue