FastLED 3.9.15
Loading...
Searching...
No Matches

◆ lerp16by8()

LIB8STATIC uint16_t lerp16by8 ( uint16_t a,
uint16_t b,
fract8 frac )

Linear interpolation between two unsigned 16-bit values, with 8-bit fraction.

Definition at line 489 of file lib8tion.h.

490{
491 uint16_t result;
492 if( b > a) {
493 uint16_t delta = b - a;
494 uint16_t scaled = scale16by8( delta, frac);
495 result = a + scaled;
496 } else {
497 uint16_t delta = a - b;
498 uint16_t scaled = scale16by8( delta, frac);
499 result = a - scaled;
500 }
501 return result;
502}
LIB8STATIC_ALWAYS_INLINE uint16_t scale16by8(uint16_t i, fract8 scale)
Scale a 16-bit unsigned value by an 8-bit value, which is treated as the numerator of a fraction whos...
Definition scale8.h:468

References LIB8STATIC, and scale16by8().

+ Here is the call graph for this function: