|
From: | E. Weddington |
Subject: | Re: [avr-gcc-list] Efficient I/O handling w. bitfields codegen problem |
Date: | Thu, 02 Dec 2004 17:14:33 -0700 |
User-agent: | Mozilla Thunderbird 0.7.3 (Windows/20040803) |
Ned Konz wrote:
The OP didn't specify his command line, so it's indeterminate if the optimizer was on.On Thursday 02 December 2004 3:00 pm, E. Weddington wrote:The canonical way to change bits in ports in C language is not through the use of bitfields. You need to learn to use the C language's bitwise operators, in conjunction with a simple macro include in avr-libc: #include <avr/io.h> PORTA |= _BV(1); // Set bit 1 PORTA &= ~_BV(1); // Clear bit 1Actually, GCC does a nice job (when the optimizer is on) of using bitfields.
It just looks like it's producing inefficient code to access const fields in const structs.
I'm sure he could look at the gcc source code to find out.
[Prev in Thread] | Current Thread | [Next in Thread] |