On Wed, 21 Jun 2023 19:02:59 GMT, ExE Boss <d...@openjdk.org> wrote: >> src/java.base/share/classes/java/lang/Long.java line 563: >> >>> 561: StringUTF16.putChar(buf, 7, (byte) i3); >>> 562: StringUTF16.putChar(buf, 8, '-'); >>> 563: StringUTF16.putChar(buf, 9, (byte) (i4 >> 8)); >> >> This might be cheating but you could avoid a store of 0 to the high byte >> (its already zero) by inlining the code from StringUTF16.putChar(); just >> double the index on the store of the byte. >> >> buf[0] = (byte) (i0 >> 8); >> buf[2] = (byte) i0; >> buf[4] = (byte) (i1 >> 8); >> buf[6] = (byte) i1; >> buf[8] = (byte) (i2 >> 8); >> ... > > Note that `StringUTF16::putChar` takes endian‑ness into account, so the above > code would only be correct on half of the supported endian types.
i have simplified the code using ENDIAN and COMPACT_STRINGS ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14578#discussion_r1237641739