What is the difference between RCR and ROR?

前端 未结 2 1685
南方客
南方客 2021-01-04 22:32

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

相关标签:
2条回答
  • 2021-01-04 23:06

    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

    0 讨论(0)
  • 2021-01-04 23:10

    Both instructions rotate bits from left to right (where the left hand bit is the MSB).

    RCR rotates the carry flag into the MSB and the LSB to the carry flag.

    ROR rotates the LSB to the MSB without going through the carry flag.

    +--> CF -->  MSB --> ... -> LSB --+
    |                                 |      RCR
    +---------------------------------+
    
    
    +-> CF      +-> MSB --> ... -> LSB --+
    |           |                        |      ROR
    +------------------------------------+
    
    0 讨论(0)
提交回复
热议问题