Integer::digits should be defined as byte[]

Chen Liang chen.l.liang at oracle.com
Sat May 24 06:37:12 UTC 2025


I have one concern with byte conversion - now the arguments to StringUTF16.putChar is sign extended instead of zero extended. We need to ensure sign extension does not affect the intrinsics, maybe need static asserts to ensure all elements of the digit byte arrays are positive so we won't run into trouble with signed vs zero extension.

Once we can address this UTF16 risk, I think we are fine with the latin1 usages, and storing the digits as a byte array is indeed more memory efficient and is a good cleanup.

Regards,
Chen Liang
________________________________
From: core-libs-dev <core-libs-dev-retn at openjdk.org> on behalf of wenshao <shaojin.wensj at alibaba-inc.com>
Sent: Friday, May 23, 2025 10:47 PM
To: core-libs-dev <core-libs-dev at openjdk.org>
Subject: Integer::digits should be defined as byte[]

Now Integer/Long uses Integer::digits to convert to byte, so we should define Integer::digits as byte[], which can avoid the conversion.

-
Shaojin Wen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20250524/00dd1329/attachment.htm>


More information about the core-libs-dev mailing list