Re: Unexpected 32-bit results from left shift operator in XC8 v2.20
A bad assumption many newcomers to C make is, thinking the size of an expression is controlled by the size of the variable to the left of the "=".
In fact, that is irrelevant, the expression is evaluated by ONLY looking at what appears to the right of the equals, using the size of the largest operand.
Only when the calculation is complete, does it attempt to cram the result into the variable on the left, at which time sign extension may occur.
To get a useful answer, always state which PIC you are using!