RFR: 8342650: Move getChars to DecimalDigits [v2]
Chen Liang
liach at openjdk.org
Wed Nov 6 03:16:39 UTC 2024
On Tue, 5 Nov 2024 15:47:00 GMT, Shaojin Wen <swen at openjdk.org> wrote:
>> Move getChars methods of StringLatin1 and StringUTF16 to DecimalDigits to reduce duplication
>>
>> 1. HexDigits and OctalDigits also include getCharsLatin1 and getCharsUTF16
>> 2. Putting these two methods into DecimalDigits can avoid the need to expose them in JavaLangAccess
>> 3. Eliminate duplicate code in BigDecimal
>
> Shaojin Wen has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 11 additional commits since the last revision:
>
> - Merge remote-tracking branch 'upstream/master' into int_get_chars_dedup_202410
> - fix Helper
> - fix Helper
> - fix Helper
> - unsafe putByte
> - remove digitPair
> - fix import
> - remove JLA
> - remove unused code
> - add comments
> - ... and 1 more: https://git.openjdk.org/jdk/compare/303de364...73b32004
src/java.base/share/classes/jdk/internal/util/DecimalDigits.java line 136:
> 134:
> 135: // Used by trusted callers. Assumes all necessary bounds checks have
> 136: // been done by the caller.
We have comment in the method already, don't need this one
src/java.base/share/classes/jdk/internal/util/DecimalDigits.java line 415:
> 413: int packed = DIGITS[v];
> 414: putCharLatin1(buf, charPos, packed & 0xFF);
> 415: putCharLatin1(buf, charPos + 1, packed >> 8);
Does merge store work here? Original code in StringLatin1 uses direct array writes, not sure about this version.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21593#discussion_r1830284792
PR Review Comment: https://git.openjdk.org/jdk/pull/21593#discussion_r1830286715
More information about the core-libs-dev
mailing list