# Thread: More Bitwise Arithmetic

1. 1234567 ^ 7 ^ ~~1234567

5 & (12345678 ^ ~~ 12345678)

My prof said there is an easy way to solve these as there is a trick to it. Does anyone know what trick is being referred to?

2. Originally Posted by tmt
1234567 ^ 7 ^ ~~1234567

5 & (12345678 ^ ~~ 12345678)

My prof said there is an easy way to solve these as there is a trick to it. Does anyone know what trick is being referred to?
The "tricks" here are just the basic properties of bitwise arithmetic, namely that ~~x is equivalent to x (negating a bit, and then negating it again, gives you back the original bit) and x ^ x is equivalent to 0 (look at the truth table for exclusive-or). Finally, ^ is commutative. Does that make it easier?

3. Originally Posted by Bacterius
Finally, ^ is commutative.
Nitpicking. We also need that ^ is associative, which it is.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•