CW> 0111 0000 0000 0000 0111(binary)
CW> Taking the 1's compliment
CW> 1000 1111 1111 1111 1000
When you apply a bit-wise operator to a variable, ALL the bits are
affected (not just the subset of bits which hold your interest). This
looks correct to me.
CW> why do i get -8 ?
CW> can you explain ?
The left-most bit (bit 0) holds the sign of a number (in this case, an
int). Flipping it as you did changes the sign from positive (0) to
negative (1).
* KWQ/2 1.2i *
--- FLAME v1.1
---------------
* Origin: Port Chicago's Loading Dock - 510-676-5359 (1:161/204)
|