From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,95a7ce6b0163274c X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-05-08 08:24:24 PST Path: newsfeed.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!nycmny1-snh1.gtei.net!cambridge1-snf1.gtei.net!news.gtei.net!inmet!not-for-mail From: Tucker Taft Newsgroups: comp.lang.ada Subject: Re: implementing software unsigned divide Date: Tue, 08 May 2001 11:24:23 -0400 Organization: AverStar (formerly Intermetrics) Burlington, MA USA Message-ID: <3AF80FA7.49816047@averstar.com> References: NNTP-Posting-Host: nebula.burl.averstar.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: inmet2.burl.averstar.com 989335460 2933 141.199.8.77 (8 May 2001 15:24:20 GMT) X-Complaints-To: usenet@inmet2.burl.averstar.com NNTP-Posting-Date: 8 May 2001 15:24:20 GMT X-Mailer: Mozilla 4.75 [en] (X11; U; SunOS 5.7 sun4u) X-Accept-Language: en Xref: newsfeed.google.com comp.lang.ada:7325 Date: 2001-05-08T15:24:20+00:00 List-Id: 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)