RFR: 8317515: Unify the code of the parse*() families of methods in j.l.Integer and j.l.Long [v2]
Raffaello Giulietti
rgiulietti at openjdk.org
Fri Oct 6 09:42:16 UTC 2023
On Fri, 6 Oct 2023 03:06:08 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:
>> Raffaello Giulietti has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Avoid localized integers in radix-out-of-range exception messages.
>
> src/java.base/share/classes/java/lang/Integer.java line 767:
>
>> 765: /* Use MIN_VALUE + x < MIN_VALUE + y as unsigned x < y comparison */
>> 766: while (i < len && (digit = digit(s.charAt(i++), radix)) >= 0
>> 767: && (inRange = MIN_VALUE + result < MIN_VALUE + multmax
>
> `compareUnsigned(result, multmax) < 0` would be better here.
`MIN_VALUE + result < MIN_VALUE + multmax` is C2-compiled to a single unsigned compare instruction (@merykitty [you should know](https://github.com/openjdk/jdk/pull/6101) ;-) )
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16050#discussion_r1348468468
More information about the core-libs-dev
mailing list