RFR: 8333833: UUID toString removes the use of ByteArrayLittleEndian [v3]
Chen Liang
liach at openjdk.org
Sun Jun 9 07:03:18 UTC 2024
On Sat, 8 Jun 2024 23:30:38 GMT, Shaojin Wen <duke at openjdk.org> wrote:
>> After PR #16245, C2 optimizes stores into primitive arrays by combining values into larger stores. In the UUID.toString method, ByteArrayLittleEndian can be removed, making the code more elegant and faster.
>
> Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision:
>
> change method name, putHex -> putHex4, and fix comments
src/java.base/share/classes/java/util/UUID.java line 1:
> 1: /*
We can update copyright year to 2024
src/java.base/share/classes/jdk/internal/util/HexDigits.java line 1:
> 1: /*
We can update copyright header to `Copyright (c) 2023, 2024, Oracle ...`
src/java.base/share/classes/jdk/internal/util/HexDigits.java line 118:
> 116: /**
> 117: * Insert the unsigned 2-byte integer into the buffer as 4 hexadecimal digit ASCII bytes,
> 118: * {@code i} only least significant 16 bits are used.
Suggestion:
* only least significant 16 bits of {@code i} are used.
src/java.base/share/classes/jdk/internal/util/HexDigits.java line 123:
> 121: * @param i to convert
> 122: */
> 123: public static void putHex4(byte[] buffer, int off, int i) {
I recommend the name `put4`. `Hex` is redundant within the context of `HexDigits`.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19610#discussion_r1632187884
PR Review Comment: https://git.openjdk.org/jdk/pull/19610#discussion_r1632187984
PR Review Comment: https://git.openjdk.org/jdk/pull/19610#discussion_r1632187743
PR Review Comment: https://git.openjdk.org/jdk/pull/19610#discussion_r1632187666
More information about the core-libs-dev
mailing list