inline frequently used color utilities (up to 15% faster)

* moving color_blend, color_add, and color_fade to a seperate file, to allow the compiler to inline the functions.

* inlining slightly increases firmware size - original non-inline functions get used on 8266, or when WLEDMM_SAVE_FLASH is defined.
This commit is contained in:
Frank
2025-01-17 21:42:26 +01:00
parent 0eec8e46c9
commit 985fa1fd3f
4 changed files with 188 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
#include "wled.h"
#if !defined(ARDUINO_ARCH_ESP32) || !defined(WLEDMM_FASTPATH) || defined(WLEDMM_SAVE_FLASH) // WLEDMM: color utils moved into colorTools.hpp, so comiler can inline calls (up to 12% faster)
/*
* Color conversion & utility methods
*/
@@ -108,6 +109,7 @@ IRAM_ATTR_YN __attribute__((hot)) uint32_t color_fade(uint32_t c1, uint8_t amoun
return scaledcolor;
}
}
#endif
void setRandomColor(byte* rgb)
{