Name
Ror -- right bit rotation (V3.0)
Synopsis
result = Ror(a, x[, length])
Function
This function rotates the bits of value a to the right by x bits. Bit rotation means that the bits just circle inside a, i.e. bits moved out of the right side are appended to the left side.

The optional argument allows you to specify the length of the rotate operation. By default, this is #INTEGER which means that a will be regarded as a 32-bit integer value. If you want to do a 16-bit or an 8-bit rotation, you need to use #SHORT and #BYTE, respectively.

Inputs
a
source value
x
number of bits to rotate
length
optional: bit length for this operation (defaults to #INTEGER which means 32-bit rotation); use #SHORT for 16-bit rotation and #BYTE for 8-bit rotation
Results
result
rotated value
Example
r = Ror(Val("%10011110"), 2, #BYTE)
Print(BinStr(r, #BYTE))
The code above rotates the binary number %10011110 2 bits to the right and prints the result which is %10100111.

Show TOC