Hi Steve, single bit fields are efficient when signed. The compare operations will be performed faster.
~d On Thursday 28 August 2003 18:32, Steve Underwood wrote: > 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? > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Mspgcc-users mailing list > Mspgcc-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/mspgcc-users -- /***************************************************************** ("`-''-/").___..--''"`-._ (\ Dimmy the Wild UA1ACZ `6_ 6 ) `-. ( ).`-.__.`) State Polytechnical Univ. (_Y_.)' ._ ) `._ `. ``-..-' Radio-Physics Departament _..`--'_..-_/ /--'_.' ,' Saint Petersburg, Russia (il),-'' (li),' ((!.-' +7 (812) 5403923, 5585314 *****************************************************************/