bitOffset += loop->bitVar;
}
else {
- /* does not fit; need to realign first */
- sum++;
- loop->offset = (su == UNION ? sum = 0 : sum);
- bitOffset = 0;
- SPEC_BSTR (loop->etype) = bitOffset;
- bitOffset += loop->bitVar;
+ if( TARGET_IS_PIC16 && getenv("PIC16_PACKED_BITFIELDS") ) {
+ /* if PIC16 && enviroment variable is set, then
+ * tightly pack bitfields, this means that when a
+ * bitfield goes beyond byte alignment, do not
+ * automatically start allocatint from next byte,
+ * but also use the available bits first */
+ fprintf(stderr, ": packing bitfields in structures\n");
+ SPEC_BSTR (loop->etype) = bitOffset;
+ bitOffset += loop->bitVar;
+ loop->offset = (su == UNION ? sum = 0 : sum);
+ } else {
+ /* does not fit; need to realign first */
+ sum++;
+ loop->offset = (su == UNION ? sum = 0 : sum);
+ bitOffset = 0;
+ SPEC_BSTR (loop->etype) = bitOffset;
+ bitOffset += loop->bitVar;
+ }
}
while (bitOffset>8) {
bitOffset -= 8;
&& ( (SPEC_USIGN (etype1)
/* if this operand is promoted to a larger type,
then it will be promoted to a signed type */
- && !(getSize (etype1) < getSize (reType))
+ && !(bitsForType (etype1) < bitsForType (reType))
/* char require special handling */
&& !IS_CHAR (etype1))
|| /* same for 2nd operand */
(SPEC_USIGN (etype2)
- && !(getSize (etype2) < getSize (reType))
+ && !(bitsForType (etype2) < bitsForType (reType))
&& !IS_CHAR (etype2))
|| /* if both are 'unsigned char' and not promoted
let the result be unsigned too */