You are viewing a single comment's thread. Return to all comments →
For x > 0, you can just subtract input from an equal number of "on" bits, e.g.
if x = 1010 perform: 1111 - 1010 and that's the answer.
I haven't found a really easy way (in C++) of making that 1111 number, though.
Seems like cookies are disabled on this browser, please enable them to open this website
The Great XOR
You are viewing a single comment's thread. Return to all comments →
For x > 0, you can just subtract input from an equal number of "on" bits, e.g.
if x = 1010 perform: 1111 - 1010 and that's the answer.
I haven't found a really easy way (in C++) of making that 1111 number, though.