diff --git a/docs/cheatsheet/common-inline-functions/sead.mdx b/docs/cheatsheet/common-inline-functions/sead.mdx index fca3509..bdd8221 100644 --- a/docs/cheatsheet/common-inline-functions/sead.mdx +++ b/docs/cheatsheet/common-inline-functions/sead.mdx @@ -6,6 +6,18 @@ sidebar_position: 0 sead is Nintendo's C++ standard library. It provides basic data structures such as strings and tree maps and many other essential components (e.g. threads, critical sections, file IO, etc.) +## Math + +### min/max functions + +When dealing with fmin/fmax instructions, pay close attention to the exact instruction and their order of operands. If the order of operands is wrong, try swapping the arguments of the call to the respective function call. + +When calculating the minimum of two floating point operands, either the instruction `fmin` or `fminnm` can be used by the compiler. The former is usually generated by `sead::Mathf::maxClamp`, while `fminnm` is generated by `sead::Mathf::min`. Both of these will show up as `fminf` in the pseudocode. + +```cpp +fmin => sead::Mathf::maxClamp +fminnm => sead::Mathf::min +``` ## Strings