2009-02-25, 05:54 PM
KajitiSouls Wrote:That was frankly confusing. I understand what you mean, but what if the rest of the stuff after the bits was all zeros? That's why I don't like such display of operations. Though granted it's a lot better for extremely large numbers. (hey you actually decided to get dynamic!)
Well, I found - to be somewhat inappropriate. I'm sure you did as well. (...) works prolly better. ((...) represents an infinite sequence of 1's)
I could try to explain how to bit-calc negative values, sh.
-1 is always represented in xoring as (...) 1. -10 is always (...) 10. -11 is (...) 01 or (...) 101.
First, find the positive binary number of the negative number. [1, 10, 11]
Second, remove 1 from the number. [0, 1, 10]
Third, NOT the number (switch all 1s to 0s and vice versa). [(...) 0, (...) 1, (...) 01]
Then XOR. If needed, convert back from negative value just reversing the way above. Tadaa, done.
Example:
[1 0000 0000, 1]
[1111 1111, 0]
[(...) 0000 0000, (...) 1]
Code:
(...) 0000 0000
XOR (...) 1111 1111
= 1111 1111Then, the computing way is just simply to take (2^bits - a) XOR (2^bits - b). Gotta do it with a byte more though.

