I am currently learning about bitwise operation, so bear with me. I understand AND, OR, and shifting. What I don't understand is bit flipping.
0101. When someone says to me "flip those", it would result in
1010 which is
10. So why does
I think I got this very wrong. Can someone enlight me?
(I am putting this here because I think it is a general programming question and not a specific one, which would belong to stack overflow).
Edit 1 Thanks to mcfinnigan's comment I learned that there is a "most significant bit" that defines if a number is positive or negative (correct me if I'm wrong). This would explain why positive results are ending up negative and vice versa. However, IMO the example above would result in
Edit 2 Thanks to Don 01001100 and S.Lott, I finally got it.