FastLED 3.10.6
Loading...
Searching...
No Matches

◆ ease8InOutCubic()

LIB8STATIC fract8 ease8InOutCubic ( fract8 i)

8-bit cubic ease-in / ease-out function.

Takes around 18 cycles on AVR.

Definition at line 574 of file lib8tion.h.

575{
576 fl::u8 ii = scale8_LEAVING_R1_DIRTY( i, i);
577 fl::u8 iii = scale8_LEAVING_R1_DIRTY( ii, i);
578 // Do not rely on the generated multiplication instructions to restore
579 // AVR's zero register: honor the _LEAVING_R1_DIRTY contract explicitly.
580 cleanup_R1();
581
582 fl::u16 r1 = (3 * (fl::u16)(ii)) - ( 2 * (fl::u16)(iii));
583
584 fl::u8 result = r1;
585
586 // if we got "256", return 255:
587 if( r1 & 0x100 ) {
588 result = 255;
589 }
590 return result;
591}
unsigned char u8
Definition stdint.h:131
expected< T, E > result
Alias for expected (Rust-style naming)
Definition result.h:31

References LIB8STATIC.

Referenced by cubicwave8().

+ Here is the caller graph for this function: