x86 Assembly Language Reference Manual

Rotate Right (ror)

ror{bwl}		imm8, r/m[8|16|32]
ror{bwl}		%cl, r/m[8|16|32]

r/m high-order bit -> CF

CF -> r/m low-order bit

r/m -> ShiftRight


The right rotate instruction shifts all bits in the register or memory operand specified. The least significant bit is rotated to the carry flag, the carry flag is rotated to the most significant bit position, all other bits are shifted to the right. The result does not include the original value of the carry flag. The first operand value indicates how many times the rotate takes place. The value is either the contents of the CL register or an immediate number. For a single rotate, where the first operand is one, the overflow flag (OF) is defined. For all other cases, OF is undefined. After the shift, the carry flag bit is XORed with the two most significant result bits.

rcrb $1, 1(%esi)
 rcrb $253, 1(%esi)
 rcrb %cl, 1(%esi)
 rcrl $1, 4(%edi)
 rcrl $253, 4(%edi)
 rcrl %cl, 4(%edi)