RFR: 6506405: Math.abs(float) is slow [v3]

Joe Darcy darcy at openjdk.java.net
Thu Jul 8 15:48:57 UTC 2021


On Thu, 8 Jul 2021 15:34:16 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Please consider this change to make the `float` and `double` versions of `java.lang.Math.abs()` branch-free.
>
> Brian Burkhalter has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR.

src/java.base/share/classes/jdk/internal/math/DoubleConsts.java line 80:

> 78:      * significand fields) of a {@code double}.
> 79:      */
> 80:     public static final long    MAG_BIT_MASK = 0x7FFFFFFFFFFFFFFFL;

Might be more "obviously correct" if these new fields were initialized as ~SIGN_BIT_MASK.

-------------

PR: https://git.openjdk.java.net/jdk/pull/4711


More information about the core-libs-dev mailing list