> uint8_t a = 5;
>
> what struck me, was that the following returned FALSE:
>
> (~a == (255-a))
>
>
> { Note:
> b00000101 = 5
> b11111010 = ~5 = 250 = (255-5)
> }
>
> Did i miss something or is this a (un-)known problem?
You missed the fact that the arguments to "-" are promoted to integer type
before the subtraction is performed. For example you should run this
code:
printf ("%x %x %x %x\n", a, ~a, 255-a, (~a == (255-a)));
John Regehr
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help