avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] Efficient I/O handling w. bitfields codegen problem


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:

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 1

Actually, GCC does a nice job (when the optimizer is on) of using bitfields.
The OP didn't specify his command line, so it's indeterminate if the optimizer was on.

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.


reply via email to

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