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
Message
RE: [lpc2000] fastest register modification
2006-01-19 by Paul Curtis
Attachments
- No local attachments were found for this message.