Advertisement
CosminVarlan

13. Shiftare biti - mai multi, cu carry - fara pierdere (ASM)

Dec 16th, 2021
973
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. volatile uint16_t v = 255;
  2. void setup()
  3. {
  4.   Serial.begin(9600);
  5.   asm(
  6.     "lsl %A0 \n" // shiftare la stg
  7.     "rol %B0 \n" // rotate left through carry
  8.     : "+r" (v)
  9.     );
  10.     Serial.println(v); // 510 (pentru ca nu se mai pierde)
  11. }
  12.  
  13. void loop(){}
  14.  
  15. // ror = rotate right cu carry
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement