What is Bitwise and what is the difference between Bitwise Exclusive Or and Regular Or? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is Bitwise and what is the difference between Bitwise Exclusive Or and Regular Or?

17th Sep 2016, 1:03 AM
Esteban
2 Answers
+ 2
Bitwise: Regular True/False comparison is not being done (otherwise values like 3 would always be true). Instead, for (numeric) values each binary digit (bit) of the binary expansion is compared, one at a time. OR: if either bit compared is 1, return 1 for that bit position. XOR: Either one OR the other bit can be 1, but not both (one excludes the other): first second |or ^xor 0 0 0 0 0 1 1 1 1 0 1 1 1 1 1 0 <-difference 5 | 3 = 7 (101 or 011 = 111) 5 ^ 3 = 6 (101 xor 011 = 110)
30th Sep 2016, 6:32 AM
Kirk Schafer
Kirk Schafer - avatar
0
as name suggests bitwise or implement on bits by changing into its binary form and simple or is used to check that if any condition is true in given two conditions
22nd Sep 2016, 3:35 AM
Gaurav Agarwal
Gaurav Agarwal - avatar