docs by Matt K

This commit is contained in:
rusefi 2019-01-06 20:48:15 -05:00
parent 45d4243636
commit b3ba88f819
2 changed files with 5 additions and 0 deletions

View File

@ -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

View File

@ -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)