Need reviewer: JDK 8 CR for Support Integer overflow
fweimer at bfk.de
Fri Feb 3 14:44:39 UTC 2012
* Roger Riggs:
> 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
That's what I got in my second attempt, too. It doesn't result in a
longer dependency chain because the left side of the & is two operations
deep, too. Therefore, this version should be faster (at least after
compilation), independent of the input arguments.
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