8323552: AbstractMemorySegmentImpl#mismatch returns -1 when comparing distinct areas of the same instance of MemorySegment

Reviewed-by: mcimadamore
This commit is contained in:
Per Minborg 2024-03-25 09:37:24 +00:00
parent b235682a18
commit 93579c29e3
2 changed files with 30 additions and 7 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -681,10 +681,6 @@ public abstract sealed class AbstractMemorySegmentImpl
long dstBytes = dstToOffset - dstFromOffset;
srcImpl.checkAccess(srcFromOffset, srcBytes, true);
dstImpl.checkAccess(dstFromOffset, dstBytes, true);
if (dstImpl == srcImpl) {
srcImpl.checkValidState();
return -1;
}
long bytes = Math.min(srcBytes, dstBytes);
long i = 0;