| View previous topic :: View next topic |
| Author |
Message |
Freiza Grandmaster Cheater
Reputation: 22
Joined: 28 Jun 2010 Posts: 662
|
Posted: Sun Sep 26, 2010 5:17 pm Post subject: Reversing 'And' operation |
|
|
suppose var1 == 11001111
var2 == 00000100
var1 + var 2 == 00000100 (let us say it var 3)
what operation on var3 can i make so that i can get var1 again for any numbers.
ie var3 (some operation) (value) = var1
|
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Sun Sep 26, 2010 5:27 pm Post subject: |
|
|
i fucked up, poster below has it right
Last edited by Slugsnack on Sun Sep 26, 2010 5:28 pm; edited 2 times in total |
|
| Back to top |
|
 |
XaLeX Expert Cheater
Reputation: 0
Joined: 19 Aug 2008 Posts: 226
|
Posted: Sun Sep 26, 2010 5:27 pm Post subject: |
|
|
You can't.
0 & 0 = 0 & 1 = 1 & 0 = 0
this means that a zero in var3 can be originated by three combinations of var1 and var2, and you can't just "reverse" it.
The only thing you can tell is what bits of both var1 and var2 are surely set, that is, the ones that are set in var3.
|
|
| Back to top |
|
 |
Freiza Grandmaster Cheater
Reputation: 22
Joined: 28 Jun 2010 Posts: 662
|
Posted: Sun Sep 26, 2010 5:31 pm Post subject: |
|
|
i thought as xoring twice brings up the same result .
then there must be some way out..
|
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Sun Sep 26, 2010 5:42 pm Post subject: |
|
|
| think about it logically. if you have a 0 result bit and you know one of the original bits was 1 then yes, the other is 0. if the other original bit you do know was 0 however you don't know what the other bit could've been.
|
|
| Back to top |
|
 |
|