Format: Number of Shl/Shr mobile digits
Description: The operands and return values are both integers.
Example:
16 (10) = 10000 (2)
16 (10) Shr 1 = 10000 (2) Shr 1 = 1000 (2) = 8 (10)
16 (10) Shr 2 = 10000 (2) Shr 2 = 100 (2) = 4 (10)
Note:
An integer (I) shifts one digit left by bit, which is equivalent to multiplying it by 2, that is, I * 2
An integer (I) shifts one digit right by bit, which is equivalent to dividing it by 2, that is, I Div 2
An integer (I) shifts two places to the left by bit, which is equivalent to multiplying it by 2 and then by 2, that is, (I * 2) * 2
An integer (I) shifts two places to the right by bit, which is equivalent to dividing it by 2 and then Division 2, that is, (I Div 2) Div 2
Analysis:
Reference our most commonly used decimal description. If there is a number of 16, move one digit to the right in decimal, and 1 is left in the result. If one digit to the left is 160, it is equivalent to 16 Div 10 and 16*10;
Similarly, in binary, the sum of division and multiplication is 2.
The result is only an operation between the operand and the hexadecimal number.