On Jul 17, 2009, at 5:43 PM, Adeilton Oliveira wrote: > I don't know how the division operation is internally implemented, > but I > think in your case you can use >>4 instead of /16. Its a simple matter to examine the generated assembly with the debugger in AVR Studio. Or to ask avr-gcc (WinAVR) to leave the assembly laying around after a compile, or to generate a disassembly from the object file. Think you will find avr-gcc is smart enough to >>4 for a constant / 16. I know it will replace /2 with a right shift. Meanwhile using the division in one's source is usually the right thing to do for human comprehension. Replacing division with shifts is one of those things that makes assembly harder for someone other than the original author to understand. Makes it harder for the original author to understand 6 months after it was written. -- David Kelly N4HHE, dkelly@HiWAAY.net ======================================================================== Whom computers would destroy, they must first drive mad.
Message
Re: [AVR-Chat] Moving average filter
2009-07-19 by David Kelly
Attachments
- No local attachments were found for this message.