RFR: 8342650: Move getChars to DecimalDigits [v4]

Shaojin Wen swen at openjdk.org
Mon Nov 11 11:48:39 UTC 2024


On Sun, 20 Oct 2024 17:33:09 GMT, j3graham <duke at openjdk.org> wrote:

>> Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   add benchmark
>
> src/java.base/share/classes/java/math/BigDecimal.java line 4216:
> 
>> 4214:         // Get the significand as an absolute value
>> 4215:         if (intCompact != INFLATED) {
>> 4216:             coeff = new char[19];
> 
> A possibility here would be to change `coeff` to be a String. The “else” branch already creates a string and has to additionally create a char array from it. If this is the only place where the `DecimalDigits.getChars(… char[])` is used, some extra code duplication could be removed.

@j3graham I have submitted PR #22009

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21593#discussion_r1836545951


More information about the core-libs-dev mailing list