I'm having problems with the following simple line of code and was wondering if I could get a little insight as to what the problem may be..
My code..
My variables SystemStatus is declared as a unsigned int.
And MODEFAIL_BITS is equal to 0x0110.
Here is the simple line of cdoe.. The casts to UINT16 were added to try to solve the problem but were in vain.
if ((UINT16)SystemStatus & (UINT16)MODEFAIL_BITS) { ..Print out some stuff and set a flag. }
This compiles to the following.
; SOURCE LINE # 2776 015C E500 E MOV A,SystemStatus+01H 015E 5410 ANL A,#010H 0160 FF MOV R7,A 0161 7401 MOV A,#01H 0163 4F ORL A,R7 0164 603B JZ ?C0394
Which gives the wrong answer.. In my particular case
SystemStatus is 0x4000 MODEFAIL_BITS is 0x0110
The answer I get is 0x0100.. Looking at the assembly code I can see why I get that answer.. but looking at my C code I can;t see why I'm getting that assembly code..
Any ideas or suggestions are greatly appreciated... Thanks..