From e802bf698dab311b5490933fd628c8eda6a76075 Mon Sep 17 00:00:00 2001 From: Tim Brooks Date: Fri, 3 Sep 2021 12:58:21 -0600 Subject: [PATCH] Remove double byte copy in lz4 unsafe utils Currently in LZ4UnsafeUtils#safeIncrementalCopy every byte is copied twice. First the byte is copied using the normal byte array syntax and then the byte is copied using unsafe. Only one of these copies is needed. This commit deletes the non-unsafe copy. --- src/java-unsafe/net/jpountz/lz4/LZ4UnsafeUtils.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/java-unsafe/net/jpountz/lz4/LZ4UnsafeUtils.java b/src/java-unsafe/net/jpountz/lz4/LZ4UnsafeUtils.java index ec2ee9f..5385e4b 100644 --- a/src/java-unsafe/net/jpountz/lz4/LZ4UnsafeUtils.java +++ b/src/java-unsafe/net/jpountz/lz4/LZ4UnsafeUtils.java @@ -98,7 +98,6 @@ static void wildIncrementalCopy(byte[] dest, int matchOff, int dOff, int matchCo static void safeIncrementalCopy(byte[] dest, int matchOff, int dOff, int matchLen) { for (int i = 0; i < matchLen; ++i) { - dest[dOff + i] = dest[matchOff + i]; writeByte(dest, dOff + i, readByte(dest, matchOff + i)); } }