RFR: 8337167: StringSize deduplication

Chen Liang liach at openjdk.org
Thu Jul 25 10:49:33 UTC 2024


On Thu, 25 Jul 2024 05:30:34 GMT, Shaojin Wen <duke at openjdk.org> wrote:

> Integer.stringSize and Long.stringSize are used not only in java.lang, but also in other places. We put stringSize in DecimalDigits to reduce duplicate code and the use of JLA.

src/java.base/share/classes/java/lang/Integer.java line 472:

> 470:      * code after loop unrolling.
> 471:      */
> 472:     static int stringSize(int x) {

Same question, if we can just inline this

src/java.base/share/classes/java/lang/Long.java line 502:

> 500:      * code after loop unrolling.
> 501:      */
> 502:     static int stringSize(long x) {

Can we just remove this method?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20322#discussion_r1691241572
PR Review Comment: https://git.openjdk.org/jdk/pull/20322#discussion_r1691240301


More information about the core-libs-dev mailing list