[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Mega 128 not optimising correctly ...

From: E. Weddington
Subject: Re: [avr-gcc-list] Mega 128 not optimising correctly ...
Date: Mon, 11 Nov 2002 14:25:12 -0700

On 12 Nov 2002 at 9:29, Rob Ward wrote:

> Hi Eric. I am using AVR-GCC 3.2 20020616 (experimental).
> Regarding -std=gnu99 ... I am not using this switch. I have found this
> info on it ... A new edition of the ISO C standard was published in
> 1999 as ISO/IEC 9899:1999, and is commonly known as C99. GCC has
> incomplete support for this standard version;
> seehttp://gcc.gnu.org/c99status.htmlfor details. To select this
> standard, use `-std=c99' or `- std=iso9899:1999'. (While in
> development, drafts of this standard version were referred to asC9X.)
> Regards, Rob

Ok, it's the same version. If you don't want to use the same -std 
switch then, I have one other suggestion.

It was brought up that in Standard C most operators promote chars to 
ints. This could produce non-optimal code. Try typecasting the 
operations to unsigned char and see if that will clean up the code. 
The bit-wise NOT is especially known to do this. So try something 
like this:

#define SetClockHigh() ((unsigned char)PORTD |= (unsigned char)0x80) 
// set clock line high

#define SetClockLow() ((unsigned char)PORTD &= (unsigned char)~0x80) 
// set clock line low
// Note the placement of typecast before the bit-wise NOT.

Note, that I haven't tried this, as I don't get the same problem.

avr-gcc-list at http://avr1.org

reply via email to

[Prev in Thread] Current Thread [Next in Thread]