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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user