reversed and & or operators

Started by
1 comment, last by Yohomyth 19 years, 10 months ago
This is for people who know about the and, or, xor, etc. operators. Is there a way to reverse the effect of and & or? For example: 204 & 170 = 136 11001100 (204) & 10101010 (170) = 10001000 (136) Now can we get the number back to 204 using just 170 and 136? ----------------------------------------------- Here comes the Thnikkaman!
------------------------------------------------------------"Many combilations elizagerth. I hope you see my particles." - Senor Cardgage
Advertisement

Unfortunately not, let's look at the & operator:

a       b         AND1       1          11       0          00       1          00       0          0

So let's think we only know b & the result and let's try to guess what a was:

b      AND      Guess of a1       1        must be 10       0        0 or 11       0        must be 00       0        0 or 1

So we know for certain only the bits of a where the corresponding bit of b was 1. It works quite the same for OR too, but reversed.

[edited by - clb on June 6, 2004 5:30:23 AM]

Xor can be reversed:

A xor B = C <==> C xor B = A

This topic is closed to new replies.

Advertisement