Left Shift:
The '<<' operator is used to perform Left Shift Operations.
'x<<y' means x shifted by y bits to the left. Like $00101<<2=10100$.
If you start shifting and you run out of space, the bits just drop off. Here are some more examples:
\[00011001<<2=01100100\]
\[00011001<<4=10010000\]
Right Shift:
The '>>' operator is used to perform the Right Shift Operations.
'x>>y' means x is shifted by y bits to the left. Like $00101>>2 = 00001$. If you start shifting and you run out of space, the bits just drop off the end. Here are some more examples:
\[00011001>>2=00000110\]
\[00011001>>4=00000001\]
No comments:
Post a Comment