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

◆ add8to16()

LIB8STATIC_ALWAYS_INLINE uint16_t add8to16 ( uint8_t i,
uint16_t j )

Add one byte to two bytes, with 16-bit result.

Note
This does not saturate and may overflow!
Parameters
ifirst value to add, 8-bit
jsecond value to add, 16-bit
Returns
the sum of i + j, 16-bit

Definition at line 162 of file math8.h.

162 {
163#if ADD8_C == 1
164 uint16_t t = i + j;
165 return t;
166#elif ADD8_AVRASM == 1
167 // Add i(one byte) to j(two bytes)
168 asm volatile("add %A[j], %[i] \n\t"
169 "adc %B[j], __zero_reg__ \n\t"
170 : [j] "+r"(j)
171 : [i] "r"(i));
172 return i;
173#else
174#error "No implementation for add8to16 available."
175#endif
176}
static uint32_t t
Definition Luminova.h:54

References LIB8STATIC_ALWAYS_INLINE, and t.