Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between RCR and ROR?

I understand the from the terms that RCR would rotate the bit from the right to left, taking the bit from the carry while ROR will rotate the bit from right to left, taking the bit from the right but is that the only difference between them? If this is so, both of the instructions seem to do the same work. Please help out. Thanks

like image 483
Foo Avatar asked May 01 '12 07:05

Foo


People also ask

What is RCR in assembly language?

Rotate With Carry Right (rcr)

What is ROR operation?

Operation. ROR provides the value of the contents of a register rotated by a value. The bits that are rotated off the right end are inserted into the vacated bit positions on the left.

What is RCL in assembly language?

The RCL (Rotate and Carry Left) instruction shifts each bit to the left, copies the Carry flag to the least significant bit and copies the most significant bit into the Carry flag.

Which flag is involved in moving bits in the context of RCL and RCR instructions?

The RCL and RCR instructions include the CF flag in the rotation. The RCL instruction shifts the CF flag into the least-significant bit and shifts the most-significant bit into the CF flag.


1 Answers

RCR includes the carry flag in the rotation, so it's effectively an N+1 bit rotate, whereas ROR does not include the carry flag, so it's just an N bit rotate.

Some nice diagrams from www.c-jump.com:

enter image description here

enter image description here

like image 130
Paul R Avatar answered Sep 21 '22 17:09

Paul R