Can anyone explain the usage(not the definition) of binary shift operators?? How and where do you use them in a code?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can anyone explain the usage(not the definition) of binary shift operators?? How and where do you use them in a code??

usage of binary shift operators

15th Dec 2016, 3:35 PM
Pankaj Hazra
Pankaj Hazra - avatar
1 Answer
+ 6
They are used for bit level manipulation. For example you could shift a value to count how many bits are set in a register. See an example here: https://code.sololearn.com/c96KnEcilBQ2/?ref=app. In embedded programming bit shifting is also used for creating bit masks to read/write values to registers.
30th Dec 2016, 5:12 AM
Jay Azurin
Jay Azurin - avatar