This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: 8/16bit oddities on avr-gcc


"Michael Kukat" <michael@unixiron.org> writes:

> Hello,
>
> i'm programming a lot of AVR firmware since a while, first in pure
> assembler, as gcc 3.x didn't produce code i liked very much. But the
> 4.1.1 i'm currently using produces quite good code if you sometimes
> try around to get the best results (as in "i would write nearly the
> same in assembler").
>
> But now, i found one strange thing where i currently can't find a
> workaround i really like. It's about a quite simple loop here:
>
> This is my perftest.c file:
> #include <avr/io.h>
> #include < inttypes.h>
>
> volatile uint8_t xx;
>
> void test() {
>        uint8_t ctr;
>
>        ctr = 0;
>        do {
>                xx = ctr;
>        } while(++ctr < 64);

Try "while((uint8_t)(++ctr) < 64)"

-- 
Sergei.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]