On Fri, 8 Sep 2023 20:13:01 GMT, Roger Riggs <rri...@openjdk.org> wrote:
>> 温绍锦 has updated the pull request incrementally with one additional commit >> since the last revision: >> >> add DIGITS description > > src/java.base/share/classes/java/util/HexDigits.java line 81: > >> 79: for (int j = 0; j < 16; j++) { >> 80: short hi = (short) ((j < 10 ? j + '0' : j - 10 + 'a') << >> 8); >> 81: digits[(i << 4) + j] = (short) (lo | hi); > > The part that is counter-intuitive is that the bits that are shifted left > appear to the right of the bits that are not shifted. (the actual bits are > correct, either way, but it reads oddly). In a short, the resulting bits > would be `hhll`. > Suggestion: > > digits[(i << 4) + j] = (short) (hi | lo); > > Similarly, the returns of the other `packDigits` methods do not read MSB to > LSB. You are right, I have changed ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14745#discussion_r1320310958