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

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

References LIB8STATIC_ALWAYS_INLINE, and scale.

Referenced by nscale8x2_video(), and nscale8x3_video().

+ Here is the caller graph for this function: