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
-
i | input value to scale |
scale | scale 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)
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().