Hi Dmitry,

I'm not quite sure I follow you. Do you mean it is just single bit fields that are inefficient, or are multi-bit fields bad too? So I should change the "tip" in the manual, or is it already giving the correct advice?

Regards,
Steve

Dmitry wrote:

this is compiler's...
ansi says that bitfields (:1) should be compared as signed.
so, if this declared unsigned, a long ;) procedure to convert unsigned to signed involved.

~d

On Wednesday 27 August 2003 15:33, Ralf Guetlein wrote:
But why? Is there a restriction (ANSI) or is it just a compiler weakness?
To my understanding, if you have a single-bit field, there should be no
room for interpretation, esp. when you compare to 0, so a

if (s.field) [...]

should lead to the same code, whether signed or not.

Ralf


"Dmitry" <di...@mail.ru> schrieb im Newsbeitrag
news:200308271414.54269.di...@mail.ru...

no..
this mostly applies to a single bit operand like ...{int a1:,...};
~d

I'd like to understand this suggestion a bit more, as if I want to store 0,

1, 2, or 3 in a bitfield, it seems like you are suggesting that I should
use 3 bits instead of the expected 2 bits that would be required in an
unsigned bit field.  What can be done to make msp430-gcc to generate
better

code for the unsigned integer bit field also?



Reply via email to