On Wed, 29 Oct 2025 22:46:24 GMT, Jorn Vernee <[email protected]> wrote:

>>> A user can easily convert between one or the other length representation by 
>>> multiplying/dividing by the right scalar
>> 
>> That is true of e.g. UTF-16 but not of UTF-8, since the encoding is variable 
>> width and doing the conversion from bytes to characters is more expensive 
>> there.
>> 
>>> Either way, we felt that it would be a good idea if you could send an email 
>>> to panama-dev in which you describe your exact use case, before getting 
>>> further into the code review. That would give others a chance to respond 
>>> with their use cases as well.
>> 
>> Sounds good, thanks, I can start a thread discussing the use-case here at a 
>> higher level.
>
>> > A user can easily convert between one or the other length representation 
>> > by multiplying/dividing by the right scalar
>> 
>> That is true of e.g. UTF-16 but not of UTF-8, since the encoding is variable 
>> width and doing the conversion from bytes to characters is more expensive 
>> there.
> 
> Sorry, I don't mean 'character' but 'code unit'. For instance, when reading a 
> UTF-8 string, the unit would be one byte, for UTF-16 it would be two, for 
> UTF-32 four. So a user would just need to divide by the unit size, at least 
> that's the idea.

> I can start a thread discussing the use-case here at a higher level.

Done: https://mail.openjdk.org/pipermail/panama-dev/2025-November/021182.html

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28043#discussion_r2487389933

Reply via email to