Fix erroneous logic in memCopy (#253)

This commit is contained in:
Raven Szewczyk authored and GitHub committed 2026-01-05 18:30:52 +00:00
1 parent e0b9884d82
commit eb45bee56a
1 file changed
+2 -2
@@ -17,9 +17,9 @@ final class MultiReleaseMemCopy {
static void copy(long src, long dst, long bytes) {
// A custom Java loop is fastest at small sizes, approximately up to 160 bytes.
if (BITS64 && ((src | dst) & 7) == 0) {
if (BITS64 && bytes < 160L && ((src | dst) & 7L) == 0L) {
// both src and dst are aligned to 8 bytes
memCopyAligned64(src, dst, (int) bytes & 0xFF);
memCopyAligned64(src, dst, (int) bytes);
} else {
// Unaligned fallback. Poor performance until Java 16.
UNSAFE.copyMemory(null, src, null, dst, bytes);