Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Yohomyth

reversed and & or operators

This topic is 5220 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
Advertisement

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


a b AND
1 1 1
1 0 0
0 1 0
0 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 a
1 1 must be 1
0 0 0 or 1
1 0 must be 0
0 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]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!