Faster divides (Stuart Denman)
Sat, 14 Oct 1995 10:18:15 GMT

          From comp.compilers

Related articles
Faster divides (1995-10-14)
Re: Faster divides (1995-10-23)
Re: Faster divides (1995-10-25)
| List of all articles for this month |

From: (Stuart Denman)
Keywords: arithmetic, performance, question
Organization: Computer Science & Engineering, U of Washington, Seattle
Date: Sat, 14 Oct 1995 10:18:15 GMT

I remember someone saying there was a trick to speed up something like this
where you have all long variables and you divide multiple times by the same

long dsh,dtx,dty,dy; some calculations to find values for them...
dsh = (dsh << 16) / dy;
dtx = (dtx << 16) / dy;
dty = (dty << 16) / dy;

I tried using 3 floating-point multiplies, but that is way slower, even on
a Pentium due to the large speed hit of converting back-and-forth from
integer to floating-point.

Does anyone know of an algorithm to speed this up without having to do these
3 very similar divides? It seems like there would be one since you are
dividing by the exact same value!

Thanks for any help you can offer,

Stuart Denman


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.