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,78b2880bc7e78e39 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-03-19 03:15:42 PST Path: supernews.google.com!sn-xit-02!supernews.com!news.gv.tsc.tdk.com!hub.org!hub.org!newsfeed.wirehub.nl!news.maxwell.syr.edu!newsfeed.icl.net!newspeer.clara.net!news.clara.net!dispose.news.demon.net!demon!btnet-peer0!btnet!news5-gui.server.ntli.net!ntli.net!news6-win.server.ntlworld.com.POSTED!not-for-mail From: "chris.danx" Newsgroups: comp.lang.ada References: <3ab5d2a4$1@pull.gecm.com> Subject: Re: RISC X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Message-ID: Date: Mon, 19 Mar 2001 11:06:56 -0000 NNTP-Posting-Host: 62.253.12.170 X-Complaints-To: abuse@ntlworld.com X-Trace: news6-win.server.ntlworld.com 985000010 62.253.12.170 (Mon, 19 Mar 2001 11:06:50 GMT) NNTP-Posting-Date: Mon, 19 Mar 2001 11:06:50 GMT Organization: ntlworld News Service Xref: supernews.google.com comp.lang.ada:5837 Date: 2001-03-19T11:06:56+00:00 List-Id: Thanks for that, Chris Campbell "Martin Dowie" wrote in message news:3ab5d2a4$1@pull.gecm.com... > I had a similar problem recently when I had to mimic unsigned 64 bits with > only > unsigned 32 bits available. > > For addition and subtract it is fairly easy. e.g. > > a = 255, b = 1 > c = a + b > if c < a then overflow as it has wrapped > > similarly for subtraction with > instead of <. > > I only required +/- support, so I'm afraid I have no solutions for * or / > :-( > > The long-hand way for multiplications would be to add e.g. > a = 90, b = 3 > c = 0 > for I in 1 .. b loop > c = c + a > if c < a then overflow as it has wrapped > end loop > > not very efficient... > > Sorry, no ideas spring to mind for division... > > chris.danx wrote in message > news:qrws6.3335$bL.360000@news6-win.server.ntlworld.com... > > Two quickies! I hope! > > > >[snip] > > > > I'm using mod types to simulate registers in the RISC machine. I'm about > to > > implement arithmetic operations but i've thought of a problem. How do i > > detect overflow? > > > > e.g. > > say it was 1 byte reg > > > > 25*158 is too big. > > > > 12+254 is too big also. > > >