From: sandeep Date: Tue, 14 Nov 2000 18:19:06 +0000 (+0000) Subject: more on bitfields X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=4d16538c3e2019eee68a8db2d987b363bbdac2fc;p=fw%2Fsdcc more on bitfields git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@500 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/src/SDCCsymt.c b/src/SDCCsymt.c index f3980ed4..a952e428 100644 --- a/src/SDCCsymt.c +++ b/src/SDCCsymt.c @@ -838,7 +838,6 @@ int compStructSize (int su, structdef *sdef ) /* for the identifiers */ loop = sdef->fields ; while ( loop ) { - int pbvar =0; /* create the internal name for this variable */ sprintf (loop->rname,"_%s",loop->name); @@ -856,8 +855,7 @@ int compStructSize (int su, structdef *sdef ) /* next byte boundary */ if ((SPEC_BLEN(loop->etype)=loop->bitVar) <= (8 - bitOffset)) { SPEC_BSTR(loop->etype) = bitOffset ; - sum += (loop->bitVar / 8) ; - bitOffset += (loop->bitVar % 8); + if ((bitOffset += (loop->bitVar % 8)) == 8) sum++; } else /* does not fit */ { @@ -867,7 +865,7 @@ int compStructSize (int su, structdef *sdef ) bitOffset += (loop->bitVar % 8); } /* if this is the last field then pad */ - if (!loop->next && bitOffset) { + if (!loop->next && bitOffset && bitOffset != 8) { bitOffset = 0 ; sum++ ; } @@ -881,13 +879,9 @@ int compStructSize (int su, structdef *sdef ) if (funcInChain(loop->type)) { processFuncArgs (loop, 1); } - pbvar = loop->bitVar; + loop = loop->next ; - /* if this is a bitvar & the previous one was not */ - if (loop && loop->bitVar && pbvar == 0) { - bitOffset = 0; - sum++; - } + /* if this is not a bitfield but the */ /* previous one was and did not take */ /* the whole byte then pad the rest */