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

◆ lerp15by8()

LIB8STATIC int16_t lerp15by8 ( int16_t a,
int16_t b,
fract8 frac )

Linear interpolation between two signed 15-bit values, with 8-bit fraction.

Definition at line 506 of file lib8tion.h.

507{
508 int16_t result;
509 if( b > a) {
510 uint16_t delta = b - a;
511 uint16_t scaled = scale16by8( delta, frac);
512 result = a + scaled;
513 } else {
514 uint16_t delta = a - b;
515 uint16_t scaled = scale16by8( delta, frac);
516 result = a - scaled;
517 }
518 return result;
519}
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: