Integrated: 8271601: Math.floorMod(int, int) and Math.floorMod(long, long) differ in their logic
Raffaello Giulietti
github.com+70726043+rgiulietti at openjdk.java.net
Tue Aug 10 17:19:55 UTC 2021
On Mon, 2 Aug 2021 19:59:57 GMT, Raffaello Giulietti <github.com+70726043+rgiulietti at openjdk.org> wrote:
> Hello,
>
> please review this tiny change in the implementation of j.l.Math.floorMod(int, int).
>
> While the results are unaffected, all of
> floorDiv(int, int)
> floorDiv(long, long)
> floorMod(long, long)
> use x ^ y in the tests to correct the result if needed.
>
> Not only is the proposed change more consistent with the other methods, but it might benefit later stages in the cpu to proceed with the evaluation of x ^ y in parallel with the previous x % y and, depending of the outcome, even further down.
>
>
> Greetings
> Raffaello
This pull request has now been integrated.
Changeset: 66d1faa7
Author: Raffaello Giulietti <raffaello.giulietti at gmail.com>
Committer: Brian Burkhalter <bpb at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/66d1faa7847b645f20ab2e966adf0a523e3ffeb2
Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
8271601: Math.floorMod(int, int) and Math.floorMod(long, long) differ in their logic
Reviewed-by: bpb
-------------
PR: https://git.openjdk.java.net/jdk/pull/4962
More information about the core-libs-dev
mailing list