1. Arithmetic left shift logic left
The arithmetic left shift and the logical left shift are the right 0:
Like 00101011.
Shift arithmetic left one: 01010110
Shift logic left one: 01010110
For binary values, the left-shift n-bit equals the original value multiplied by 2 of the n-th square.
For example, 110,100 binary is 26, left two digits after 011010 00 turn to decimal is 104 times 26.
PS: This multiple relationship only applies if the left-hand post-abandoned high position does not contain 1, otherwise it overflows.
2. Arithmetic right shift, logical right SHIFT
Logical right shift is simple, as long as the binary number is moved to the right, the left 0 can be
such as 10101101 logical right shift one to 01010110
The arithmetic right shift symbol bit is moved together, and the symbol bit on the left side, that is, if the sign bit is 1, the 1 sign bit is 0, 0
For example: 11100 arithmetic right Shift one is 11110 (sign bit 1 moves along and complements 1 on the left)
For binary values, the right shift n is equal to the original value divided by 2 of the n-th square.
For example, 101.101 million binary is 76 (you need to convert this complement to the original code and then converted to decimal), the right shift two digits after 11101101 turns to decimal is 19 is 76 times.
PS: This multiple relationship is only applicable to the less right operand after the removal of the low 1 of the situation, otherwise each 1 represents the remainder is discarded, the whole number of parts.
Pay attention to ... Here the binary is the complement, because the computer is in the complement of the operation, the above examples are positive so the complement and the same as the original code, if it is negative to pay attention to the need to first convert the complement to the source code to convert to decimal