Re: Simple/Fast Algorithm for binary logarithm in C (on ARM7)



On Fri, 11 May 2007 11:14:14 +0200, Tilmann Reh
<tilmannreh@xxxxxxxxxxxxx> wrote:

in a current ARM7 project I need to do some calculations which include a
logarithm. All other math is done with integers (i.e. fixed point
arithmetic), and I would like to calculate the log fast and with little
code - so I don't prefer using FP conversion and the standard math
libraries.

Can anyone point to fixed-point logarithmic routines I could use (resp.
tailor to my needs)?

You've gotten some responses already, but here's another you might
consider looking at. It's one of the chapters of a book that Analog
used to give away (don't know if they still do) to customers. Great
book. Anyway, this chapter covers the logarithm for the ADSP-21xx DSP
processor, but it includes a good description about the whys and
wherefores as well as a coded example (which requires a little bit of
learning of the isntruction set if you want to understand each and
every step of the code -- but that isn't too hard.) Here is the
chapter:

http://www.analog.com/UploadedFiles/Associated_Docs/727652249Chapter_4.pdf

Also, if you do actually decide to dig more deeply into the algorithm
described and then coded up in the above chapter, you could read up on
the instructions with this ZIP:

http://www.analog.com/UploadedFiles/Associated_Docs/160158757adsp_21xx_um_rev3_0.zip

(I couldn't find just the chapters online, quickly. So that is the
whole thing, I imagine.)

Jon
.



Relevant Pages