I've learned what bitwise operators do. But I've never had to use them and I've never seen them being used anywhere. Are they useful at all? If so, do they need more memory or execution time or something>
Asked
Active
Viewed 1,457 times
-1
-
http://stackoverflow.com/questions/2096916/real-world-use-cases-of-bitwise-operators – Speerian Jul 10 '15 at 17:12
-
one example is if you need to multiply by 2, you can just do a shift – Brandon Ling Jul 10 '15 at 17:27
1 Answers
3
Bitwise operators operate on the bit level and so, are rather fast and require less memory expenditure. There are many fields where you have a constraint of the available resources, like embedded devices, CPU registers, socket programming etc. In these cases, you need immediate calculation and they have low memory to spare. Similarly, devices where there is a lot of processing to be done, makes use of bitwise operations too. Many cryptography algorithms work at the bit level too.

smaug
- 846
- 10
- 26