From: Royce & S. P. <be...@im...> - 2002-07-09 13:14:47
|
Hi, I've observed that 2.3.1 converts bytes into words for left shifts, whereas it behaves properly for right shifts The following code: //================= // Short Code to show anomaly in right & left shift of byte variable in 2.3.1 unsigned char mask, flag; void main() { if(flag) mask<<=1; else mask>>=1; } //================ assembles thus: ......... ; anom.c:8: mask<<=1; <<<<<<byte left shift. ; genCast mov r2,_mask ;<<<<<cast as 16 bit (Why?) mov r3,#0x00 ; genLeftShift ; genLeftShiftLiteral ; genlshTwo mov a,r3 xch a,r2 add a,acc xch a,r2 rlc a mov r3,a ; genCast mov _mask,r2 ........ ........ ; anom.c:10: mask>>=1; <<<<<the same byte, right shift ; genRightShift ; genRightShiftLiteral ; genrshOne mov a,_mask ;<<<<<<this is ok. clr c rrc a mov _mask,a Has this been corrected? Thanks, --Royce. |