Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

RE: [lpc2000] fastest register modification

RE: [lpc2000] fastest register modification

2006-01-19 by Paul Curtis

Hi, 

> I could test this myself, but I've got bigger fish to fry, so 
> I'm just 
> throwing it out:  Is it faster to modify a particular bit in a 
> register using IAR's bit field access or to do a standard read-modify-
> write?  The compiler guide explictly says to avoid bit fields because 
> they inheriently generate large slow code.

Depends upon the bitfield declaration.  Depends upon the compiler.
Depends upon the context the assignment is made in.  In an ideal world
every compiler would generate globally-optimal code--most compilers make
a good fist of locally-optimial code.  IAR says avoid, so do it.
Bitfields are a whole world of hurt, but your own mask operation will
make you fairly portable (really!) and the intention is clear.  I do not
know why IAR favour bitfields in their device headers the way they do.
I'm sure the IAR compiler generates competent code for simple bitfield
access and assignment.

--
Paul Curtis, Rowley Associates Ltd  http://www.rowley.co.uk
CrossWorks for MSP430, ARM, AVR and now MAXQ processors

fastest register modification

2006-01-19 by Langosta39

Hi all,

I could test this myself, but I've got bigger fish to fry, so I'm just 
throwing it out:  Is it faster to modify a particular bit in a 
register using IAR's bit field access or to do a standard read-modify-
write?  The compiler guide explictly says to avoid bit fields because 
they inheriently generate large slow code.

Andy

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.