[A83] Re: 1 byte division routine


[Prev][Next][Index][Thread]

[A83] Re: 1 byte division routine





On Wed, 19 Dec 2001, Patai Gergely wrote:

> > The "standard" way of doing integer division (which is in
> the ROM routine
> > for doing so) divides a 16-bit value by an 8-bit value in
> between 710 and
> > 748 clock cycles (I didn't count very carefully, but I
> think this is
> > right) depending on the data.
> It's much slower for small divisors, that's why I
> wrote one with shift operations (similarly to
> the one you posted below) other than subtractions
> in a loop. It's long because it's unrolled. :)

Which routine is much slower for small divisors?  The routine I wrote is
similar to the ROM one, with the same kind of effects.  And what I put as
the highest value for the ROM is the worst case, dividing 65535 by 1,
where it will do the sub c and inc l for each loop, taking 748 clock
cycles then.  Thus I don't see what is so good about the 1000 cycles
routine you mentioned (which takes more cycles in each include of the
math_d than the ROM one does in each cycles through the loop regardless of
data).







Follow-Ups: References: