Jump to content

Computer related puzzles and questions


Sip

Recommended Posts

sebastia...

 

Sip's answer to that will be that he met "one"-- at office depot -- but it didnt have a good/reliable hard drive---

 

if u dotn get it...just forget it- im not making sense anymore.... :wacko:

To the contrary dear, I think you are making more sense than ever. :)

Link to comment
Share on other sites

  • 4 weeks later...
  • Replies 129
  • Created
  • Last Reply

Top Posters In This Topic

TB is obviously thinking like a mathematician!

 

The more computery dude would probably come up with

 

A = A xor B

B = A xor B

A = A xor B

 

In C/C++ or Java, you can even write it as

 

A ^= B ^= A ^= B;

 

:)

 

Conceptually there is really no difference between the arithmetic version and the logical version but as it turns out, this one can be made much faster in hardware. Also, in the strict "binary" bit-wise sense of the contents of A and B, the XOR method will swap the bits while the arithmetic version requires some notion of what addition and subtraction mean. It clearly works for integers.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...