On Mon, 17 Jul 2023 20:53:23 GMT, Roger Riggs <rri...@openjdk.org> wrote:

>> 温绍锦 has updated the pull request incrementally with one additional commit 
>> since the last revision:
>> 
>>   Integer/Long toString test against compact strings
>>   
>>   Co-authored-by: liach <li...@users.noreply.github.com>
>
> src/java.base/share/classes/java/lang/Integer.java line 528:
> 
>> 526:             i = q;
>> 527:             charPos -= 2;
>> 528:             UNSAFE.putShortUnaligned(buf, Unsafe.ARRAY_BYTE_BASE_OFFSET 
>> + charPos, PACKED_DIGITS[r], false);
> 
> When switching to use Unsafe, `getChars` should do the array bounds check in 
> the loop of the store index.

The value range of the r variable is 0-99, and the length of PACKED_DIGITS is 
100, There is no need to check the array boundary here.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14699#discussion_r1266072419

Reply via email to