Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

64bit/64bit fixed point division?

25 views
Skip to first unread message

ma...@spamnotmeplease.it

unread,
Aug 22, 2006, 5:19:29 AM8/22/06
to

Hi!
I wrote a C++ class for a 64bit fixed point numeric format,
32bit integral and 32bit fractional. I wrote addition,
subtraction and multiplication operator routines (the latter
in inline assembly). Now I need an assembly routine to inline
to compute division, but I'm having many problems finding the
fastest way to do it. How was easy with multiplication to get
advantage of the hardware multiplier!
How can it be that the "hardware" multiplier is useless in
this case? Ok, it has to do with laws of nature (a.k.a. math)
and such but, how would be the fastest way to perform a div
between two 64bit fixed point operands (with the point exactly
in the middle) and produce a 128bit result and/or a 64bit one
(I guess two versions of the routine will be necessary)?

Can anybody help with code, please? I managed to reckon that
the division will be equivalent to an integer division where
the dividend is shifted 32bits to the left, and the quotient
then is shifted the same amount to the right. But this lengthens
the division process even more, is there no way to avoid this?

Better than all, can some asm genious produce some code or
share some working code? I've spent weeks looking at the GMP
and other bignum libs code, but I'm more confused than before.

Thanks a lot!
Marie from Bozen, Italy

0 new messages