comp.lang.ada
 help / color / mirror / Atom feed
From: Tucker Taft <stt@averstar.com>
Subject: Re: implementing software unsigned divide
Date: Tue, 08 May 2001 11:24:23 -0400
Date: 2001-05-08T15:24:20+00:00	[thread overview]
Message-ID: <3AF80FA7.49816047@averstar.com> (raw)
In-Reply-To: uae4oomya.fsf@gsfc.nasa.gov

Stephen Leake wrote:
> 
> I'm porting GNAT to a 16 bit microprocessor that does not provide a
> hardware instruction for unsigned divide (it has multiply and signed
> divide, both 16 and 32 bit). Can anyone provide a reference to a book
> that discusses how to do this, and/or an algorithm that does it? I've
> looked in Knuth, and did an initial web search, and haven't found
> anything.

This is generally pretty straightforward using the
signed hardware instructions, and some appropriate
amount of fixups before and/or after the actual divide.
I suggest you try some specific examples by hand where one or
both of the values have the high bit on.  It is pretty
easy to figure out what sort of fixup, if any, is
necessary.

I have done this myself in the past, but unfortunately I didn't
write down the algorithms in a place that I can locate
at the moment.

> 
> --
> -- Stephe

-- 
-Tucker Taft   stt@avercom.net   http://www.averstar.com/~stt/
Chief Technology Officer, AverCom Corporation (A Titan Company) 
Burlington, MA  USA (AverCom was formerly the Commercial Division of AverStar:
http://www.averstar.com/services/ebusiness_applications.html)



  parent reply	other threads:[~2001-05-08 15:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-07 21:42 implementing software unsigned divide Stephen Leake
2001-05-08  6:04 ` Jacob Sparre Andersen
2001-05-08  7:44 ` Tarjei T. Jensen
2001-05-08 13:18 ` Ted Dennison
2001-05-08 15:24 ` Tucker Taft [this message]
2001-05-08 21:20   ` Stephen Leake
2001-05-09 18:00     ` Tucker Taft
2001-05-10 15:54       ` Stephen Leake
2001-05-13 23:17       ` Kenneth Almquist
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox