What ia the application of bitwise shifting operator | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What ia the application of bitwise shifting operator

Such as left shift(<<) or right shift(>>)

27th May 2019, 4:54 PM
Sharma Abhishek
 Sharma Abhishek  - avatar
5 Answers
+ 7
Abhishek Sharma if you asking of any real life use in programming then in microprocessor or designing of digital circuit modeling when we have to look for any bit is set or not to see that any operation is performed or not then we use this bit shifting to see the which bit is set by going on every bit shift according to left right and circular direction and which bit set to 0 is look for an clock cycle in positive so that it can trip up. Another example is when we want to transfer an bit to the last end from sender to receiver then this bit shifting can be used
27th May 2019, 5:16 PM
MsJ
MsJ - avatar
+ 4
The shift operator is used a lot when dealing with communication protocol. For example, the CAN protocol uses packets of 8bytes and to make the transfer of two int (4 bytes integer) efficient you would put the first int on the first 4 bytes and the second int on the last 4 bytes. Assuming you receive CAN packet data as a long (8 bytes int). You would recover thee two ints this way first_int = long_int &0xFFFF; second_int = long_int >> 4;
27th May 2019, 5:41 PM
Paul
27th May 2019, 4:57 PM
Prince PS[Not_Active]
Prince PS[Not_Active] - avatar
+ 2
I wanna know about the application in program of this operator
27th May 2019, 4:59 PM
Sharma Abhishek
 Sharma Abhishek  - avatar
+ 2
Is there any application
27th May 2019, 4:59 PM
Sharma Abhishek
 Sharma Abhishek  - avatar