Subject: Re: detect arithmetic overflow
From: David Laight <firstname.lastname@example.org>
Date: 08/06/2003 09:54:09
On Tue, Aug 05, 2003 at 02:18:08PM -0600, Ciju John wrote:
> Hi all, I need to detect arithmetic overflow when using signed integers
> (64-bit). I read that a system signal is generated upon an overflow event.
> However using signals is not an option and therefore I would like some
> other solution such as bit checks etc (something I can write a simple
> macros for).
For addition of positive numbers, just check for the result being
less than either operand.
For multiply it is all rather harder...
David Laight: email@example.com