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!

Reply via email to