On Tue, 12 Nov 2024 08:15:33 GMT, Per Minborg <pminb...@openjdk.org> wrote:

>> Shaojin Wen has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   revert, from @minborg
>
> src/java.base/share/classes/sun/nio/cs/StringUTF16.java line 35:
> 
>> 33:     public static char getChar(byte[] val, int index) {
>> 34:         return unsafe.getChar(val,
>> 35:                 (long) ARRAY_BYTE_BASE_OFFSET + ARRAY_BYTE_INDEX_SCALE * 
>> index * 2L);
> 
> This expression already contains `2L` which is a `long`. So, isn't the result 
> of the multiplications of type `long`, and consequently, isn't the entire 
> expression calculated with `long` precision as it is?

You are right, there is no need to add an explicit type conversion here.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22027#discussion_r1837663142

Reply via email to