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: Ned Konz
Subject: Re: [avr-gcc-list] Efficient I/O handling w. bitfields codegen problem
Date: Thu, 2 Dec 2004 16:08:20 -0800
User-agent: KMail/1.7.1

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. 

It just looks like it's producing inefficient code to access const fields in 
const structs.

-- 
Ned Konz
http://bike-nomad.com



reply via email to

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