Re: 32 bit fixed point division



>sbhavikb wrote:
>> >> uint64_t remainder;
>...
>> >> remainder = remainder << 1;
>...
>> Hay, can anyone please give a code for 32 bit fixed point division
which
>> would work for a 32 bit DSP processor. It looks like this code will
not
>> work, as it involves working with a 64 bit integer.
>
>These operations on large unsigned integers can be broken down into
>operations on sets of smaller integers. For instance, a left
>shift on a uint64 can be broken down into shifting two 32-bit integers,
>plus copying the former MSB of one into the resulting LSB of the
>other. See any textbook on binary arithmetic or multi-precision
>arithmetic.
>
>So the earlier posted code will work just fine, with simple
>modifications, not only for 32-bit processors, but for 16-bit and
>8-bit CPU's as well.
>
>And if you want a potentially faster multi-precision integer division
>routine, look into non-restoring algorithms, which can save on some
>comparison cycles.
>
>
>IMHO. YMMV.
>--
>rhn A.T nicholson d.O.t C-o-M
>
>

Hi,
Thank you very much for the suggestion. But my intension to ask the
question was to have the answer of the division routine in 32 bit. The
posted routine gives the answer as 64 bit integer which I can not use in
my program, as there are so many other routines which have to follow the
division routine and those have to take 32 bit answer of the division
routine. I tried converting this 64 bit answer in 32 bit but somehow it
didnt work out. Can you please suggest some way out?

Thank you very much,

Thanks and Regards,
BS


This message was sent using the Comp.DSP web interface on
www.DSPRelated.com
.



Relevant Pages

  • Re: Detecting a service that is running
    ... I wrote a routine to determine the state of a given service, but I couldn't imagine that it would be that easy. ... it's not an option for me since I can't guarantee that the WMI service is running. ... This is the problem with multiposting, I posted code in the other thread that would possibly be more useful to you. ...
    (microsoft.public.vb.winapi)
  • Re: Numerical Evaluation of the 2F1 hypergeometric function for large and complex value
    ... recipes routine but this routine couldn't act with ... C++ routine, which can act with complex b, c and ... I have posted code for this before, and I recall that it was ...
    (comp.lang.c)