Left rotation

From CANNY Wiki
Jump to: navigation, search
5 4 7 2.png
Bitwise operators
Value: Integer
Shift, bits: Integer
Result: Integer
Version CANNY Lab
from 1.8b

Circular shift to the left. Set the output result as the logical left shift in binary representation of the input "Value", the number of bits to shift specified by the input "Shift, bits", while leaving bit appears in place of free pop spot on the other end of the number .

In other words, the result is equivalent to the result of copying each bit in binary representation of input "value" to its left position, to the number of times specified by the value of the input "Shift, bits". Thus, least significant (right-most) bit in the binary representation each time will have a value equal to the outgoing (most significant, extending to the left) bit of input value.

For example:

Value = 51000 = 0xC738 = 0b1100011100111000
Shift, bits = 2
Result = 7395 = 0x1CE3 = 0b0001110011100011


Circular shift of 16-bit value in either direction for 8-bit, reverses its upper and lower bytes.


As decimal
As binary

See also[edit]

Bitwise AND

Bitwise OR

Bitwise exclusive OR

Bitwise Inversion

Right shift

Left shift

Right rotation

Built-in Function Blocks