On Wed, 7 Jul 2021 20:28:37 GMT, Brian Burkhalter <[email protected]> wrote:
> Please consider this change to make the `float` and `double` versions of
> `java.lang.Math.abs()` branch-free.
src/java.base/share/classes/java/lang/Math.java line 1530:
> 1528: @IntrinsicCandidate
> 1529: public static float abs(float a) {
> 1530: return Float.intBitsToFloat(Float.floatToRawIntBits(a) &
> 0x7fffffff);
I'd like to see a brief comment on these methods along the lines of "zero out
sign bit in the representation." Using underscores in the literal to better
group the digits or using the constants in jdk.internal.math.DoubleConsts.
-------------
PR: https://git.openjdk.java.net/jdk/pull/4711