Linear interpolation between two unsigned 8-bit values, with 8-bit fraction.
Definition at line 455 of file lib8tion.h.
456{
457 uint8_t result;
458 if( b > a) {
459 uint8_t delta = b - a;
460 uint8_t scaled =
scale8( delta, frac);
461 result = a + scaled;
462 } else {
463 uint8_t delta = a - b;
464 uint8_t scaled =
scale8( delta, frac);
465 result = a - scaled;
466 }
467 return result;
468}
LIB8STATIC_ALWAYS_INLINE uint8_t scale8(uint8_t i, fract8 scale)
Scale one byte by a second one, which is treated as the numerator of a fraction whose denominator is ...
References LIB8STATIC, and scale8().
Referenced by CRGB::lerp8().