ANSI portable overflow detection

davids@ICSI.Berkeley.EDU (David Petrie Stoutamire)
Thu, 12 May 1994 20:32:44 GMT

          From comp.compilers

Related articles
ANSI portable overflow detection davids@ICSI.Berkeley.EDU (1994-05-12)
Re: ANSI portable overflow detection upton@quip.eecs.umich.edu (1994-05-13)
Re: ANSI portable overflow detection hbaker@netcom.com (1994-05-13)
Re: ANSI portable overflow detection Roger@natron.demon.co.uk (1994-05-18)
| List of all articles for this month |

Newsgroups: comp.compilers
From: davids@ICSI.Berkeley.EDU (David Petrie Stoutamire)
Keywords: arithmetic, question
Organization: International Computer Science Institute, Berkeley, CA, U.S.A.
Date: Thu, 12 May 1994 20:32:44 GMT

The Sather language provides optional dynamic overflow checking for
integer operations. I'm writing a back-end that generates ANSI C, and I
need to emit code to check for overflow in a portable way. Addition and
subtraction are easy, but I don't know of an efficient solution for
multiplication. Can anyone tell me a way to do this that isn't much
slower than the original multiply (such as checking with a division, or
manually constructing the most significant word of the result)?


        - Dave
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.