On Wed, 8 May 2024 08:19:54 GMT, Daniel Jeliński <djelin...@openjdk.org> wrote:

> Replace the custom unsigned divide / remainder functions with the 
> compiler-optimized Long.divideUnsigned / remainderUnsigned.
> 
> No new tests. Existing tier1-3 tests continue to pass.
> 
> I added a new set of divide benchmarks. Results in thread.
> 
> I also removed the BigDecimal.toString benchmarks. They no longer serve their 
> purpose - toString caches the returned value, so we were only benchmarking 
> the cache access time.

src/java.base/share/classes/java/math/BigDecimal.java line 5683:

> 5681:         tmp = (dividendHi << shift) | (dividendLo >>> 64 - shift);
> 5682:         long u2 = tmp & LONG_MASK;
> 5683:         long q1, r_tmp;

Nit: There doesn't seem to be a reason for splitting the q1 and r_tmp 
declarations from their assignments, why not the following instead? (Also 
applies to the cases below)

long q1 = Long.divideUnsigned(tmp, v1);
long r_tmp = Long.remainderUnsigned(tmp, v1);

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19134#discussion_r1596137061

Reply via email to