Shift operator
Including: ">> right movement"; "<< left shift"; ">> No symbol right shift "
Example: -5 >> 3 = -1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 The result is identical to Math.Floor (Double) -5 / (2 * 2 * 2)).
-5 << 3 = -401111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1101 1000 The result is identical to -5 * 2 * 2 * 2.
5 >> 3 = 0000 0000 00 00 00 00 00 00 00 00 00 00 00 00 0000 The result is exactly the same as 5 / (2 * 2 * 2).
5 << 3 = 400000 0000 00 00 00 00 00 00 00 00 00 0000 00 00 00 00 00 00 0000 0010 1000 The result is exactly the same as 5 * 2 * 2 * 2.
-5 >>> 3 = 536870911 1111 1111 1111 1111 1111 1111 1111 10110001 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111
Regardless of the positive number, negative, their right shift, left shift, no symbol right shift 32 bits itself, such as -5 << 32 = -5, -5 >> 32 = -5, -5 >>> 32 = -5. One interesting phenomenon is to move 1 left to 31 points and then remove 31. The result is -1.0000 0000 0000 0000 0000 0000 00 00 00 00000000 0000 0000 0000 0000001111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111
Bit logical operator
Includes: &; | or; ~ non-(also known as a reverse); ^
"&", "| Or", "~ Non" is a basic logic, thereby evolving "with non-", "or non-", "or non-" composite logic operations. "^ Di or" is a special logical operation, which can be "same or" on it, so "the same or" logic is also called "different or non-" logic.
Examples: 5 = 1000000000000 & 3 0000 0000 0000 0000 0,101,000,000,000,000 0000 0000 0000 0000 0,011,000,000,000,000 0000 0000 0000 0000 0001
-5 & 3 = 11111 1111 1111 1111 1111 1111 1111 10110000 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0000 00110 q
5 | 3 = 70000 000 00 00 00 00 00 00 00 00 00 00 00 00 00 0010000 0000 00 00 0000 0000 0000 0111
-5 | 3 = -51111 1111 1111 1111 1111 1111 1111 10110000 00 00 00 00 00 00 00 00 00 00111111 1111 1111 1111 1111 1111 1111 1011
~ 5 = -60000 00 00 00 00 00 00 00 00 010111111 1111 1111 1111 1111 1111 1111 1010 ~ -5 = 41111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 10110000 0000 00 00 00 00 00 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 00 00
5 ^ 3 = 60000 000 00 00 00 00 00 00 00 00 00 00 00 00 00 0010 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0110
-5 ^ 3 = -8111111111111 1,111,111,111,111,111 1,011,000,000,000,000 0,000,000,000,000,000 0,011,111,111,111,111 1,111,111,111,111,111 1000 (please note that references posted this article should indicate author:! Rosen Jiang and Source: http: / /BLOG.9CBS.NET/ROSEN