You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by bo...@apache.org on 2018/05/24 14:01:09 UTC

commons-compress git commit: COMPRESS-453 replace while loop with equivalent Arrays.fill

Repository: commons-compress
Updated Branches:
  refs/heads/master 4224709bc -> e8c44e609


COMPRESS-453 replace while loop with equivalent Arrays.fill

JMH benchmarks don't show any significant difference between the two
versions.


Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/e8c44e60
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/e8c44e60
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/e8c44e60

Branch: refs/heads/master
Commit: e8c44e6090536bb4603d2c478724a7675e0a99fc
Parents: 4224709
Author: Stefan Bodewig <bo...@apache.org>
Authored: Thu May 24 15:59:42 2018 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Thu May 24 15:59:42 2018 +0200

----------------------------------------------------------------------
 .../compress/compressors/bzip2/BZip2CompressorInputStream.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-compress/blob/e8c44e60/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStream.java b/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStream.java
index a1c3ef6..677bbbd 100644
--- a/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStream.java
@@ -656,9 +656,9 @@ public class BZip2CompressorInputStream extends CompressorInputStream
                 final byte ch = seqToUnseq[yy0];
                 unzftab[ch & 0xff] += s + 1;
 
-                while (s-- >= 0) {
-                    ll8[++lastShadow] = ch;
-                }
+                final int from = ++lastShadow;
+                lastShadow += s;
+                Arrays.fill(ll8, from, lastShadow + 1, ch);
 
                 if (lastShadow >= limitLast) {
                     throw new IOException("block overrun while expanding RLE in MTF, "