Need reviewer: JDK 8 CR for Support Integer overflow
Roger.Riggs at oracle.com
Fri Feb 3 14:46:33 UTC 2012
The boolean expression can be refactored. (Only bit-31 is significant).
But it becomes pretty inscrutable.
(x ^ r)< 0&& (x ^ y)>= 0 becomes
(x ^ r)< 0&& (~(x ^ y))< 0 becomes
((x ^ r)& ~(x ^ y))< 0
On 02/03/2012 07:12 AM, Florian Weimer wrote:
> * Eamonn McManus:
>> On 3 February 2012 00:11, Florian Weimer<fweimer at bfk.de> wrote:
>>> Would it make sense to replace (x ^ r)< 0&& (x ^ y)>= 0
>>> with (x ^ y ^ r)< 0?
>> That would not be correct. For example, it would signal overflow for -1 + 1.
> Oops. But there has to be a way to implement this using just one
More information about the core-libs-dev