RFR: 8271601: Math.floorMod(int, int) and Math.floorMod(long, long) differ in their logic

Raffaello Giulietti github.com+70726043+rgiulietti at openjdk.java.net
Mon Aug 2 20:06:45 UTC 2021


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

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

Commit messages:
 - 8271601: Math.floorMod(int, int) and Math.floorMod(long, long) differ in their logic

Changes: https://git.openjdk.java.net/jdk/pull/4962/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=4962&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8271601
  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/4962.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/4962/head:pull/4962

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


More information about the core-libs-dev mailing list