On Fri, 4 Sep 2026 14:03:34 GMT, Per Minborg <[email protected]> wrote:

> This PR proposes to fix a bug in the `MemorySegment::asOverlapingSlice` which 
> incorrectly computes the size of the overlapping region. 
> 
> A parameterized test is also proposed via this PR
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

src/java.base/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java 
line 256:

> 254:             if (thisStart < thatEnd && thisEnd > thatStart) {
> 255:                 // The intersection is [max(starts), min(ends)).
> 256:                 final long overlapStart = Math.max(thisStart, thatStart);

New logic seems better/simpler!

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

PR Review Comment: https://git.openjdk.org/jdk/pull/32707#discussion_r3935074268

Reply via email to