+ 2
What ia the application of bitwise shifting operator
Such as left shift(<<) or right shift(>>)
5 odpowiedzi
+ 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
+ 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;
+ 2
Refer to these lessons:
https://www.sololearn.com/learn/4086/?ref=app
https://www.sololearn.com/learn/4087/?ref=app
Thanks
+ 2
I wanna know about the application in program of this operator
+ 2
Is there any application