Need reviewer: JDK 8 CR for Support Integer overflow

Florian Weimer fweimer at bfk.de
Fri Feb 3 12:12:07 UTC 2012


* 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
comparison.

-- 
Florian Weimer                <fweimer at bfk.de>
BFK edv-consulting GmbH       http://www.bfk.de/
Kriegsstraße 100              tel: +49-721-96201-1
D-76133 Karlsruhe             fax: +49-721-96201-99



More information about the core-libs-dev mailing list