Add one byte to two bytes, with 16-bit result.
- Note
- This does not saturate and may overflow!
- Parameters
-
i | first value to add, 8-bit |
j | second value to add, 16-bit |
- Returns
- the sum of i + j, 16-bit
Definition at line 153 of file math8.h.
153 {
154#if ADD8_C == 1
155 uint16_t t = i + j;
156 return t;
157#elif ADD8_AVRASM == 1
158
159 asm volatile("add %A[j], %[i] \n\t"
160 "adc %B[j], __zero_reg__ \n\t"
161 : [j] "+r"(j)
162 : [i] "r"(i));
163 return i;
164#else
165#error "No implementation for add8to16 available."
166#endif
167}
References LIB8STATIC_ALWAYS_INLINE.