On Mon, 15 Apr 2024 07:50:24 GMT, Per Minborg <pminb...@openjdk.org> wrote:

> This PR proposes to add a new method `MemorySegment::maxByteAlignment` that 
> returns the maximum byte alignment of a segment (both heap and native 
> segments).
> 
> Clients can then use this method to determine if a segment is properly 
> aligned for any given layout (e.g. following a `MemorySegment::reinterpret` 
> operation).

test/jdk/java/foreign/TestMemoryAlignment.java line 154:

> 152:              Arena arena = Arena.ofConfined()) {
> 153:             var segment =channel.map(FileChannel.MapMode.READ_WRITE, 0L, 
> 32L, arena);
> 154:             assertTrue(segment.maxByteAlignment() >= Long.BYTES);

Is this always the case? Smells of platform-dependent... (e.g. think also of 
x86)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18779#discussion_r1565537503

Reply via email to