On Wed, 21 Jun 2023 14:53:22 GMT, Roger Riggs <rri...@openjdk.org> wrote:
>> 温绍锦 has updated the pull request incrementally with one additional commit >> since the last revision: >> >> add annotation Stable > > 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. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14578#discussion_r1237483291