Quote:
|
Originally Posted by Joel J.
if control can be negative, then a right shift can have a disastrous effect! mcc18 v2.4 does NOT shift in 1's for a negative number. Instead, it treats all numbers as unsigned.
For example,
int control = -16;
control = control >> 2;
After that snippet, you'd expect control to be -4, but in actuality its 16380. Quite different.
|
Wow - I definately would have thought that a shift would extend the sign.
I guess I should have RTFM.
