diff --git a/src/main/java/com/gtnewhorizon/gtnhlib/bytebuf/MultiReleaseMemCopy.java b/src/main/java/com/gtnewhorizon/gtnhlib/bytebuf/MultiReleaseMemCopy.java index 72581e36..03120a9e 100644 --- a/src/main/java/com/gtnewhorizon/gtnhlib/bytebuf/MultiReleaseMemCopy.java +++ b/src/main/java/com/gtnewhorizon/gtnhlib/bytebuf/MultiReleaseMemCopy.java @@ -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);