[Integrated] [foreign-memaccess] RFR: Add MemoryLayout::byteOffset
Chris Hegarty
chegar at openjdk.java.net
Mon May 11 10:31:10 UTC 2020
On Mon, 11 May 2020 08:30:40 GMT, Chris Hegarty <chegar at openjdk.org> wrote:
> Hi,
>
> As part of feedback on the Foreign Memory API (when experimenting with
> its usage internally in the JDK), a small number of potential usability
> enhancements could be made to the API. This is the first such.
>
> This change:
> 1) renames MemoryLayout::offset to MemoryLayout::bitOffset, and
> 2) adds MemoryLayout::byteOffset
>
> This allows for easier interoperation with MemoryAddress, which deals
> with offsets and lengths in terms of bytes (rather than bits), e.g.
> addr.addOffset(layout.byteOffset(groupElement("foo")))
>
> This brings a nice symmetry to the API; there is a trio of bit-wise
> methods: bitAlignment, bitOffset, bitSize, and their matching byte-wise
> counterparts; byteAlignment, byteOffset, byteSize.
This pull request has now been integrated.
Changeset: 1bd65632
Author: Chris Hegarty <chegar at openjdk.org>
Committer: Maurizio Cimadamore <mcimadamore at openjdk.org>
URL: https://git.openjdk.java.net/panama-foreign/commit/1bd65632
Stats: 131 lines in 2 files changed: 1 ins; 103 del; 27 mod
Add MemoryLayout::byteOffset
Reviewed-by: jvernee, mcimadamore
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/157
More information about the panama-dev
mailing list