At 06:49 PM 3/8/2001 +0000, Nicholas Clark wrote:
>On Thu, Mar 08, 2001 at 11:43:31AM -0500, Dan Sugalski wrote:
> > I was thinking maybe (length/4)*31-bit 2s complement to make portable
> > overflow detection easier, but that would be only if there wasn't a good C
> > library for this available to snag.
>
>The only portable integer overflow in ANSI C is unsigned integers.
>signed integer overflow does not always do what you might expect, even
>on a 2s complement machine.
That's what the 32nd bit of each word is for. If we do addition on a
word-by-word basis and the high bit of the result is set, we know we've
overflowed, and we can set it as a carry bit for subtraction.
Dan
--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
[EMAIL PROTECTED] have teddy bears and even
teddy bears get drunk
- Re: PDD 4: Internal data types Dan Sugalski
- Re: PDD 4: Internal data types Hong Zhang
- Re: PDD 4: Internal data types Dan Sugalski
- Re: PDD 4: Internal data types Hong Zhang
- Re: PDD 4: Internal data types Dan Sugalski
- Re: PDD 4: Internal data types Paolo Molaro
- Re: PDD 4: Internal data types David Mitchell
- Re: PDD 4: Internal data types Dan Sugalski
- Re: PDD 4: Internal data types Nicholas Clark
- Re: PDD 4: Internal data types Hong Zhang
- Re: PDD 4: Internal data types Dan Sugalski
- Re: PDD 4: Internal data types Dan Sugalski
- Re: PDD 4: Internal data types Hong Zhang
- Re: PDD 4: Internal data types Nicholas Clark
- Re: PDD 4: Internal data types Dan Sugalski
- Re: PDD 4: Internal data types Bryan C. Warnock
- Re: PDD 4: Internal data types Dan Sugalski
- Re: PDD 4: Internal data types Nicholas Clark
- Re: PDD 4: Internal data types Dan Sugalski
- Re: PDD 4: Internal data types Nicholas Clark
- Re: PDD 4: Internal data types Dan Sugalski
