From: bernhardheld Date: Fri, 18 Nov 2005 13:01:00 +0000 (+0000) Subject: more about genUnpackBits X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=44ea48587bdb833449a28658128fdaa58e7ad76f;p=fw%2Fsdcc more about genUnpackBits git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3956 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/src/mcs51/gen.c b/src/mcs51/gen.c index 1d64c504..c9b86b97 100644 --- a/src/mcs51/gen.c +++ b/src/mcs51/gen.c @@ -9350,9 +9350,21 @@ genUnpackBits (operand * result, char *rname, int ptype, iCode *ifx) finish: if (offset < rsize) { + char *source; + + if (SPEC_USIGN (etype)) + source = zero; + else + { + /* signed bitfield: sign extension with 0x00 or 0xff */ + emitcode ("rlc", "a"); + emitcode ("subb", "a,acc"); + + source = "a"; + } rsize -= offset; while (rsize--) - aopPut (result, zero, offset++, isOperandVolatile (result, FALSE)); + aopPut (result, source, offset++, isOperandVolatile (result, FALSE)); } }