Yahoo Groups archive

Lpc2000

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

Message

Re: Faster integer division with KEIL

2005-12-13 by scsibob

The book "ARM System Developer's Guide" by Sloss, Symes, Wright has 
some really cool, mind-blowing algorithms for divides (and other 
arithmetic functions).  If I understood it correctly, in one section 
it indicates that you can achieve a 16-bit fixed point divide with a 
single 32-bit multiply (using the magic of modulus arithmetic).

See the discussions on division which start on page 140 (in the 
edition/printing of the book that I have) and also the section 
starting on page 216.

Somebody else already asked the question whether you are always 
dividing by the same number (I'm not sure if you have answered that 
yet).  If you always use the same divisor (or some small number of 
known-in-advance divisors), there may be all sorts of opportunities 
for optimizing the code.  If you need a generic divide routine that 
accepts any values, that's another story... (see the book for that)

scsibob


--- In lpc2000@yahoogroups.com, "uedogan" <uedogan@g...> wrote:
>
> Hi everybody,
> 
> i'm currently working with the LPC2136 and the latest KEIL C-
compiler. 
> Does anybody know some functions that provide a (much) faster 16-
bit 
> unsigned integer division than KEIL currently has? I have ~58MHz 
and 
> the division currently needs about 2us.
> I would even prefer some 32-Bit unsigned integer divisions but 
these 
> run totaly out of my available timing (KEIL needs ~3.9us for that).
> 
> Does anybody know about specialised unsigned integer division 
> functions, e.g. 24bit/16bit or 16bit/8bit?
> 
> Unfortunately i'm not familiar with the ARM assembler code. So if 
> anyone can provide code then it would be helpful if it can be 
simply 
> implemented with the KEIL compiler.
> 
> Thanks a lot,
> Uenal
>

Attachments

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.