You are viewing a single comment's thread. Return to all comments →
Or since they are all bitwise operations, just figure it out for 4 cases. If you look at the first part:
// s = ((a & b) ^ (a | b)) ((0 & 0) ^ (0 | 0)) == 0 ^ 0 == 0 ((0 & 1) ^ (0 | 1)) == 0 ^ 1 == 1 ((1 & 0) ^ (1 | 0)) == 0 ^ 1 == 1 ((1 & 1) ^ (1 | 1)) == 1 ^ 1 == 0
So you do an equivalent of xoring a number and 'and' that with xoring the number.
Seems like cookies are disabled on this browser, please enable them to open this website
AND xor OR
You are viewing a single comment's thread. Return to all comments →
Or since they are all bitwise operations, just figure it out for 4 cases. If you look at the first part:
So you do an equivalent of xoring a number and 'and' that with xoring the number.