docs by Matt K
This commit is contained in:
parent
45d4243636
commit
b3ba88f819
|
@ -30,6 +30,7 @@ endif
|
|||
|
||||
# C++ specific options here (added to USE_OPT).
|
||||
ifeq ($(USE_CPPOPT),)
|
||||
# constexpr float expf_taylor_impl probably needs just c++14 but why not go with 17?
|
||||
USE_CPPOPT = -std=c++17 -Wno-register -fno-rtti -fno-exceptions -fno-use-cxa-atexit -Werror=write-strings -Werror=type-limits
|
||||
endif
|
||||
|
||||
|
|
|
@ -318,6 +318,10 @@ float limitRateOfChange(float newValue, float oldValue, float incrLimitPerSec, f
|
|||
|
||||
constexpr float constant_e = 2.71828f;
|
||||
|
||||
// 'constexpr' is a keyword that tells the compiler
|
||||
// "yes, this thing, it's a 'pure function' that only depends on its inputs and has no side effects"
|
||||
// like how const is a constant value, constexpr is a constant expression
|
||||
// so if somewhere you used it in a way that it could determine the exact arguments to the function at compile time, it will _run_ the function at compile time, and cook in the result as a constant
|
||||
constexpr float expf_taylor_impl(float x, uint8_t n)
|
||||
{
|
||||
if (x < -2)
|
||||
|
|
Loading…
Reference in New Issue