42 unsigned int t = i + j;
45 return static_cast<uint8_t
>(
t);
46#elif QADD8_AVRASM == 1
61#elif QADD8_ARM_DSP_ASM == 1
62 asm volatile(
"uqadd8 %0, %0, %1" :
"+r"(i) :
"r"(j));
65#error "No implementation for qadd8 available."
80 return static_cast<int8_t
>(
t);
81#elif QADD7_AVRASM == 1
95 "adc %0, __zero_reg__\n\t"
100#elif QADD7_ARM_DSP_ASM == 1
101 asm volatile(
"qadd8 %0, %0, %1" :
"+r"(i) :
"r"(j));
104#error "No implementation for qadd7 available."
117 return static_cast<uint8_t
>(
t);
118#elif QSUB8_AVRASM == 1
135#error "No implementation for qsub8 available."
147 return static_cast<uint8_t
>(
t);
148#elif ADD8_AVRASM == 1
150 asm volatile(
"add %0, %1" :
"+r"(i) :
"r"(j));
153#error "No implementation for add8 available."
166#elif ADD8_AVRASM == 1
168 asm volatile(
"add %A[j], %[i] \n\t"
169 "adc %B[j], __zero_reg__ \n\t"
174#error "No implementation for add8to16 available."
186 return static_cast<uint8_t
>(
t);
187#elif SUB8_AVRASM == 1
189 asm volatile(
"sub %0, %1" :
"+r"(i) :
"r"(j));
192#error "No implementation for sub8 available."
205#elif AVG8_AVRASM == 1
215#error "No implementation for avg8 available."
230 return static_cast<uint16_t
>(tmp >> 1);
231#elif AVG16_AVRASM == 1
234 "add %A[i], %A[j] \n\t"
236 "adc %B[i], %B[j] \n\t"
247#error "No implementation for avg16 available."
259 return (i + j + 1) >> 1;
260#elif AVG8R_AVRASM == 1
268 "adc %0, __zero_reg__\n\t"
273#error "No implementation for avg8r available."
289 return static_cast<uint16_t
>(tmp >> 1);
290#elif AVG16R_AVRASM == 1
293 "add %A[i], %A[j] \n\t"
295 "adc %B[i], %B[j] \n\t"
305 "adc %A[i], __zero_reg__\n\t"
306 "adc %B[i], __zero_reg__\n\t"
311#error "No implementation for avg16r available."
324 return (i >> 1) + (j >> 1) + (i & 0x1);
325#elif AVG7_AVRASM == 1
326 asm volatile(
"asr %1 \n\t"
333#error "No implementation for avg7 available."
346 return (i >> 1) + (j >> 1) + (i & 0x1);
347#elif AVG15_AVRASM == 1
356 "adc %A[i], %A[j] \n\t"
357 "adc %B[i], %B[j] \n\t"
362#error "No implementation for avg15 available."
379 asm volatile(
"L_%=: sub %[a],%[m] \n\t"
381 " add %[a],%[m] \n\t"
410 asm volatile(
" add %[a],%[b] \n\t"
411 "L_%=: sub %[a],%[m] \n\t"
413 " add %[a],%[m] \n\t"
415 : [b]
"r"(b), [m]
"r"(m));
443 asm volatile(
" sub %[a],%[b] \n\t"
444 "L_%=: sub %[a],%[m] \n\t"
446 " add %[a],%[m] \n\t"
448 : [b]
"r"(b), [m]
"r"(m));
464 return ((
int)i * (
int)(j)) & 0xFF;
465#elif MUL8_AVRASM == 1
472 "clr __zero_reg__ \n\t"
478#error "No implementation for mul8 available."
488 unsigned p = (unsigned)i * (
unsigned)j;
492#elif QMUL8_AVRASM == 1
500 " breq Lnospill_%= \n\t"
505 " clr __zero_reg__ \n\t"
511#error "No implementation for qmul8 available."
521#elif ABS8_AVRASM == 1
533#error "No implementation for abs8 available."
555 mid = (low + hi) >> 1;
556 if ((uint16_t)(mid * mid) >
x) {
578#if (FASTLED_BLEND_FIXED == 1)
607#if (FASTLED_SCALE8_FIXED == 1)
608 partial = (a << 8) | b;
611 partial += (b * amountOfB);
612 partial -= (a * amountOfB);
615 uint8_t amountOfA = 255 - amountOfB;
619 partial = (a * amountOfA);
620 partial += (b * amountOfB);
623 result = partial >> 8;
627#elif BLEND8_AVRASM == 1
629#if (FASTLED_SCALE8_FIXED == 1)
632 partial = (a << 8) | b;
635 asm volatile(
" mul %[a], %[amountOfB] \n\t"
636 " sub %A[partial], r0 \n\t"
637 " sbc %B[partial], r1 \n\t"
638 " mul %[b], %[amountOfB] \n\t"
639 " add %A[partial], r0 \n\t"
640 " adc %B[partial], r1 \n\t"
641 " clr __zero_reg__ \n\t"
642 : [partial]
"+r"(partial)
643 : [amountOfB]
"r"(amountOfB), [a]
"r"(a), [b]
"r"(b)
653 " mul %[b], %[amountOfB] \n\t"
654 " movw %A[partial], r0 \n\t"
657 " com %[amountOfB] \n\t"
660 " mul %[a], %[amountOfB] \n\t"
662 " add %A[partial], r0 \n\t"
663 " adc %B[partial], r1 \n\t"
665 " clr __zero_reg__ \n\t"
667 : [partial]
"=r"(partial), [amountOfB]
"+r"(amountOfB)
668 : [a]
"r"(a), [b]
"r"(b)
673 result = partial >> 8;
678#error "No implementation for blend8 available."
688 uint8_t amountOfA = 255 - amountOfB;
#define FL_DISABLE_WARNING_RETURN_TYPE
#define FL_DISABLE_WARNING_IMPLICIT_INT_CONVERSION
#define FL_DISABLE_WARNING_PUSH
#define FL_DISABLE_WARNING_POP
#define FL_DISABLE_WARNING_UNUSED_PARAMETER
LIB8STATIC_ALWAYS_INLINE uint8_t qadd8(uint8_t i, uint8_t j)
Add one byte to another, saturating at 0xFF.
LIB8STATIC_ALWAYS_INLINE int8_t abs8(int8_t i)
Take the absolute value of a signed 8-bit uint8_t.
LIB8STATIC_ALWAYS_INLINE uint8_t qmul8(uint8_t i, uint8_t j)
8x8 bit multiplication with 8-bit result, saturating at 0xFF.
LIB8STATIC_ALWAYS_INLINE uint16_t avg16(uint16_t i, uint16_t j)
Calculate an integer average of two unsigned 16-bit integer values (uint16_t), rounded down.
LIB8STATIC_ALWAYS_INLINE int16_t avg15(int16_t i, int16_t j)
Calculate an integer average of two signed 15-bit integers (int16_t).
LIB8STATIC uint8_t addmod8(uint8_t a, uint8_t b, uint8_t m)
Add two numbers, and calculate the modulo of the sum and a third number, M.
LIB8STATIC_ALWAYS_INLINE uint16_t avg16r(uint16_t i, uint16_t j)
Calculate an integer average of two unsigned 16-bit integer values (uint16_t), rounded up.
LIB8STATIC_ALWAYS_INLINE int8_t qadd7(int8_t i, int8_t j)
Add one byte to another, saturating at 0x7F and -0x80.
LIB8STATIC_ALWAYS_INLINE uint8_t avg8(uint8_t i, uint8_t j)
Calculate an integer average of two unsigned 8-bit integer values (uint8_t), rounded down.
LIB8STATIC uint8_t sqrt16(uint16_t x)
Square root for 16-bit integers.
LIB8STATIC_ALWAYS_INLINE uint8_t add8(uint8_t i, uint8_t j)
Add one byte to another, with 8-bit result.
LIB8STATIC_ALWAYS_INLINE uint8_t avg8r(uint8_t i, uint8_t j)
Calculate an integer average of two unsigned 8-bit integer values (uint8_t), rounded up.
LIB8STATIC uint8_t submod8(uint8_t a, uint8_t b, uint8_t m)
Subtract two numbers, and calculate the modulo of the difference and a third number,...
LIB8STATIC uint8_t blend8(uint8_t a, uint8_t b, uint8_t amountOfB)
Blend a variable proportion (0-255) of one byte to another.
LIB8STATIC_ALWAYS_INLINE uint8_t mod8(uint8_t a, uint8_t m)
Calculate the remainder of one unsigned 8-bit value divided by anoter, aka A % M.
LIB8STATIC_ALWAYS_INLINE uint8_t sqrt8(uint8_t x)
LIB8STATIC_ALWAYS_INLINE uint16_t add8to16(uint8_t i, uint16_t j)
Add one byte to two bytes, with 16-bit result.
LIB8STATIC_ALWAYS_INLINE uint8_t sub8(uint8_t i, uint8_t j)
Subtract one byte from another, 8-bit result.
LIB8STATIC_ALWAYS_INLINE int8_t avg7(int8_t i, int8_t j)
Calculate an integer average of two signed 7-bit integers (int8_t).
LIB8STATIC_ALWAYS_INLINE uint8_t qsub8(uint8_t i, uint8_t j)
Subtract one byte from another, saturating at 0x00.
LIB8STATIC_ALWAYS_INLINE uint8_t mul8(uint8_t i, uint8_t j)
8x8 bit multiplication, with 8-bit result.
LIB8STATIC_ALWAYS_INLINE void cleanup_R1()
Clean up the r1 register after a series of *LEAVING_R1_DIRTY calls.
LIB8STATIC_ALWAYS_INLINE uint8_t scale8_LEAVING_R1_DIRTY(uint8_t i, fract8 scale)
This version of scale8() does not clean up the R1 register on AVR.
LIB8STATIC_ALWAYS_INLINE uint16_t map8_to_16(uint8_t x)
#define LIB8STATIC
Define a LIB8TION member function as static inline with an "unused" attribute.
#define LIB8STATIC_ALWAYS_INLINE
Define a LIB8TION member function as always static inline.
Defines integer mapping functions.
Defines static inlining macros for lib8tion functions.
#define FASTLED_NAMESPACE_END
#define FASTLED_NAMESPACE_BEGIN
Implements the FastLED namespace macros.
Fast, efficient 8-bit scaling functions specifically designed for high-performance LED programming.