On 12 Jun 2007 17:53:19 -0000, gangren at google dot com
<[EMAIL PROTECTED]> wrote:

I'm aware of integral promotion. But not quite understand why we can optimize
(short)((int)short_var + (int)short_var) to (short)((unsigned short)short_var +
(unsigned short)short_var), but not to (short)((short)short_var +
(short)short_var)? Is it because unsigned short has different overflow
handling?

Yes, signed short has undefined overflow, while unsigned is defined as wrapping.

--Pinski

Reply via email to