[foreign-preview] RFR: 8282070: Drop workaround from memory segment implementation

Quan Anh Mai duke at openjdk.java.net
Fri Feb 18 05:54:04 UTC 2022


On Thu, 17 Feb 2022 22:42:46 GMT, Radoslaw Smogura <duke at openjdk.java.net> wrote:

>> I get it, it's to allow creating 0-length chunks (I've thought in context of reading value).
>> 
>> If we assume `length > 0`, then `this.length - length + 1 =< this.length`, (in case `this.len == 0 -> 0 <= 0`)
>
> I'm not sure if I missed some case, but if it's in if (`length > 0`), then one `checkIndex` is redundant? Unless we want to disallow slicing 0 length indices?

Is this similar to `Objects.checkFromIndexSize`?

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

PR: https://git.openjdk.java.net/panama-foreign/pull/644


More information about the panama-dev mailing list