Talk:Bitwise operator

~ and negative values
I think the explanation may being citing the effect as the cause and vice versa. ~ is intended, as the first sentence maintains, to flip the values on all flags in a bit field. BioWare decided to represent its negative numbers by using the first bit as the sign (1 means negative 0 means positive) and expressing -1 as straight 1s. While 32 bit is what the toolset returns, not all game calculations that deal with negative numbers will reference a full 32 bits. For example ability modifiers are internally calculated and used in 8 bit. Regardless of the number of bits, -x is represented by ~x + 1, given the negative system BioWare decided on. It is -x that is a product of the BioWare negative system rather than ~x, which is not designed to understand negative numbers. WhiZard 16:58, October 1, 2011 (UTC)