How we can use byte operations? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How we can use byte operations?

Where we can use byte operations (like AND, OR, XOR)? How they are useful?

12th Nov 2016, 7:35 AM
Adefful
3 Answers
+ 5
Did you mean bitwise operations? Bitwise operations is used to manipulate values for comparisons and calculations. Common example are device drivers.(window uses those)
12th Nov 2016, 7:49 AM
Wen Qin
Wen Qin - avatar
+ 2
bitwise operations are very useful in low-level programming, when speed and memory usage matter. some things I used: - setting or reading pins and ports of a microcontroller - storing 8 booleans in one byte - shifting an integer to the left/right multiplies/divides it by two for every shift - forming byte array for communication (package) and calculating it's checksum - and more... generally, nobody forbids you to use it anywhere, but you must know what and why are you doing
12th Nov 2016, 8:52 AM
Demeth
Demeth - avatar
+ 1
Yes, i mean bitwise operations, sorry for bad english. Thanks for answering.
12th Nov 2016, 7:51 AM
Adefful