Spit Groove First ~ Why my teacher didn't teach me this stuff in college--
Continue to send chestnuts:
such as "(1+2) <<3"
You guess it's a few ~
Debug.Log ((1+2) <<3) After the output is "24".
Why?
' Cause yes '
The "left shift/Right shift" refers to the corresponding binary to shift left, the execution of 1+2=3, it becomes the 3<<3. That is: Move the 3 corresponding binary to the left 3 bits.
3 corresponding binary: 11 shift to the left 3 bits into 11000
Binary 11000 is not a decimal 24 ~ ~ ~ "
Keep expanding your mind.
3>>1<<1 =? The average person will want to move to the right and left to move back, the result must be 3 will not change AH ~ ~ ~ True • Pattern Tucson broken!
If you count it, you'll find:
Once a number is moved to the right, the binary's last digit, whether 1 or 0, is meaningless because it's gone. Then, moving to the left one, the magical and added one again with 0 fill up.
So, 3 becomes 2 binary "11" to move right one to "1", then move left one becomes "10", that is 2.
Oh, in view of this moment accidentally found this big secret, and then ask for less than equal to a number of even, you can write like this ~
Of course, you can continue to open the brain hole to expand, until you play bad it.
"C #" about the use of left/right shift operators