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 317 of file scale8.h.

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

References LIB8STATIC_ALWAYS_INLINE, and scale.

Referenced by nscale8x2_video(), and nscale8x3_video().

+ Here is the caller graph for this function: