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

◆ nscale8_video_LEAVING_R1_DIRTY()

LIB8STATIC_ALWAYS_INLINE void nscale8_video_LEAVING_R1_DIRTY ( uint8_t & i,
fract8 scale )

In place modifying version of scale8_video() that does not clean up the R1 register on AVR.

If you are doing several "scale8_video()'s" in a row, use this, and then explicitly call cleanup_R1().

Warning
You MUST call cleanup_R1() after using this function!
Warning
This function always modifies its arguments in place!
Parameters
iinput value to scale
scalescale factor, in n/256 units
See also
scale8_video()

Definition at line 311 of file scale8.h.

312 {
313#if SCALE8_C == 1 || defined(LIB8_ATTINY)
314 i = (((int)i * (int)scale) >> 8) + ((i && scale) ? 1 : 0);
315#elif SCALE8_AVRASM == 1
316 asm volatile(" tst %[i]\n\t"
317 " breq L_%=\n\t"
318 " mul %[i], %[scale]\n\t"
319 " mov %[i], r1\n\t"
320 " breq L_%=\n\t"
321 " subi %[i], 0xFF\n\t"
322 "L_%=: \n\t"
323 : [i] "+d"(i) // r16-r31, restricted by subi
324 : [scale] "r"(scale)
325 : "r0", "r1");
326#else
327#error "No implementation for scale8_video_LEAVING_R1_DIRTY available."
328#endif
329}
UISlider scale("Scale", 4,.1, 4,.1)

References LIB8STATIC_ALWAYS_INLINE, and scale.

Referenced by nscale8x2_video(), and nscale8x3_video().

+ Here is the caller graph for this function: