Part 1 Proposal for JDK-8264594
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Fri May 28 21:53:21 UTC 2021
Thanks!
I will take a look probably next week.
Cheers
Maurizio
On 28/05/2021 22:37, leerho wrote:
> Maurizio,
>
> Again sorry about the delay.
>
> Attached is a template proposal for the MemoryCopy class.
>
> I can't complete this without your proposed new copyFrom(...) method
> in MemorySegment. As it is written, it should work, but without the
> byte swap capability.
>
> I can complete the rest of the primitives like this template, if you
> would like with javadocs. I could also start writing tests, but
> without the byte-swap.
>
> Let me know what would be most helpful.
>
> Cheers,
>
> Lee
>
>
>
>
>
>
>
>
>
>
> On Thu, May 20, 2021 at 11:36 AM leerho <leerho at gmail.com
> <mailto:leerho at gmail.com>> wrote:
>
> Of course!
>
> On Thu, May 20, 2021 at 9:42 AM Maurizio Cimadamore
> <maurizio.cimadamore at oracle.com
> <mailto:maurizio.cimadamore at oracle.com>> wrote:
>
>
> On 20/05/2021 17:13, leerho wrote:
>> I am not sure if the /dstSegSlice/ requires the /srcCopyLen/.
>> I would hope that it is smart enough to realize that the
>> input length is smaller than the given offset minus the
>> segment size.
>
> asSlice has an overload that just takes an offset and infers
> the resulting size from there.
>
> But that doesn't seem what you want here - as you want the
> slice to have a specific size (the size of the input array).
>
> MemorySegment::copyFrom wants the two segments to have the
> same size, so I think you need that.
>
> In terms of performance, there's no difference between
> asSlice(offset) and asSlice(offset, size) - you have to create
> a new segment anyway.
>
> Maurizio
>
>
More information about the panama-dev
mailing list