+ 2
Como funciona este codigo?
2 Réponses
+ 3
It is shift right and shift left. Bitwise operator.
Example binary
0010 = 2 decimal
If we use shift left << 1 then..
0100 = 4 decimal
It is the same 2 * 2 = 4
-----------------------------
Example left shift
a << b <=> a * 2 ^ b
Example right shift
a >> b <=> a / 2 ^ b
____________________
*********************
Your code
*********************
x=6
(6 >> 2) << 6
|
(6 / 2^2 = 1)
(1) << 6
1 * 2^6 = 64
+ 1
Tk.very interesting.😋