minor optimization of core LED functions

* use _fast_ integer types in loops - in contrast to "uint16_t" etc, the compiler can leave out range/overflow corrections, so it might run faster.
* fcn_declare.h: revive "WLED_USE_REAL_MATH" option, which can be a bit faster on ESP32.
This commit is contained in:
Frank
2023-04-21 16:44:58 +02:00
parent 363567434d
commit 9130e4be54
5 changed files with 47 additions and 45 deletions

View File

@@ -70,7 +70,8 @@ void toggleOnOff()
//scales the brightness with the briMultiplier factor
byte scaledBri(byte in)
{
uint16_t val = ((uint16_t)in*briMultiplier)/100;
if (briMultiplier == 100) return(in); // WLEDMM shortcut
uint_fast16_t val = ((uint_fast16_t)in*(uint_fast16_t)briMultiplier)/100; // WLEDMM
if (val > 255) val = 255;
return (byte)val;
}