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 500 of file math8.h.

500 {
501#if ABS8_C == 1
502 if (i < 0)
503 i = -i;
504 return i;
505#elif ABS8_AVRASM == 1
506 asm volatile(
507 /* First, check the high bit, and prepare to skip if it's clear */
508 "sbrc %0, 7 \n"
509
510 /* Negate the value */
511 "neg %0 \n"
512
513 : "+r"(i)
514 : "r"(i));
515 return i;
516#else
517#error "No implementation for abs8 available."
518#endif
519}

References LIB8STATIC_ALWAYS_INLINE.

Referenced by getPaletteIndex(), and getPaletteIndex().

+ Here is the caller graph for this function: