|
From: | Robert Dewar |
Subject: | Re: GCC optimizes integer overflow: bug or feature? |
Date: | Tue, 19 Dec 2006 08:47:40 -0500 |
User-agent: | Thunderbird 1.5.0.8 (Windows/20061025) |
Paolo Bonzini wrote:
No, it has not. For example, if a is 0x40000000 in a 32 bit type and arithmetic wraps, a*2 = -0x80000000 (overflow), and hence (a*2)/2 = -0x40000000 = -1073741824.Paolo
Yes indeed, my mistake, I was thinking unsigned :-( and of course signed is the whole point here!
[Prev in Thread] | Current Thread | [Next in Thread] |