Amazing, I have worked with bit logic for 8 years ( well at least constantly in this 8 years ) and this just now stumps me. I use ~ all the time to check inverted pins state and it always works as it should. I sure hope there is an easy explanation for this one.
I want to do a compare on this.
( ~0b11111110 == 0b00000001)
I woudl have though this was true, but I'm wrong? Yet both values are 254.
So then I figure order of op, but no... Then I figure it was because I have to value it first ( yeah grabbing at straws now )
char a = ~0b00000001;
if ( a == 0b11111110)
Still not true, what in the heck am I missing here?