Hi Alex, On Wed, Apr 22, 2009 at 5:51 AM, Alex Wenger <a.wen...@gmx.de> wrote: ...snip... >>> Try the following version of set_status: >>> >>> void set_status(uint32_t flag, uint8_t set) { >>> if (set) *(uint32_t* &status) |= flag; >>> else *(uint32_t* &status) &= ~flag; >>> asm("" : : : "memory"); >>> } ...snip... > Why? The memory clobber does exactly what you need for using it in an > interrupt and outside.
So what exactly does asm("" : : : "memory"); do? Why is it significant for use inside an interrupt handler? I'm guessing that it prevents re-ordering, but it isn't clear to me why reordering would be bad in this situation. -- Dave Hylands Shuswap, BC, Canada http://www.DaveHylands.com/ _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list