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

◆ abs8()

LIB8STATIC_ALWAYS_INLINE int8_t abs8 ( int8_t i)

Take the absolute value of a signed 8-bit uint8_t.

Definition at line 516 of file math8.h.

516 {
517#if ABS8_C == 1
518 if (i < 0)
519 i = -i;
520 return i;
521#elif ABS8_AVRASM == 1
522 asm volatile(
523 /* First, check the high bit, and prepare to skip if it's clear */
524 "sbrc %0, 7 \n"
525
526 /* Negate the value */
527 "neg %0 \n"
528
529 : "+r"(i)
530 : "r"(i));
531 return i;
532#else
533#error "No implementation for abs8 available."
534#endif
535}

References LIB8STATIC_ALWAYS_INLINE.

Referenced by getFirePaletteIndex(), getPaletteIndex(), and getPaletteIndex().

+ Here is the caller graph for this function: