RFR: 8188044: We need Math.unsignedMultiplyHigh [v2]
Andrew Haley
aph at openjdk.java.net
Fri Jul 2 09:44:01 UTC 2021
On Thu, 1 Jul 2021 18:08:22 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> Please consider this proposal to add a method `unsignedMultiplyHigh(long,long)` to each of `java.lang.Math` and `java.lang.StrictMath`.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>
> 8188044: Add @see links between multiplyHigh() and unsignedMultiplyHigh().
src/java.base/share/classes/java/lang/Math.java line 1211:
> 1209: long z1 = t >>> 32;
> 1210:
> 1211: return x1 * y1 + z1 + (z0 >>> 32);
Suggestion:
long result = Math.multiplyHigh(x, y);
if (x < 0) result += y;
if (y < 0) result += x;
return result;
-------------
PR: https://git.openjdk.java.net/jdk/pull/4644
More information about the core-libs-dev
mailing list