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/01/21 13:30:42 UTC

[3/3] commons-compress git commit: remove magic value

remove magic value


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

Branch: refs/heads/master
Commit: c1470f52ed67a82abcadb0333ea2620f11e475c5
Parents: 0e1e80c
Author: Stefan Bodewig <bo...@apache.org>
Authored: Sun Jan 21 14:27:56 2018 +0100
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Sun Jan 21 14:27:56 2018 +0100

----------------------------------------------------------------------
 .../org/apache/commons/compress/utils/BitInputStream.java | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-compress/blob/c1470f52/src/main/java/org/apache/commons/compress/utils/BitInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/utils/BitInputStream.java b/src/main/java/org/apache/commons/compress/utils/BitInputStream.java
index e0645b3..ad1f229 100644
--- a/src/main/java/org/apache/commons/compress/utils/BitInputStream.java
+++ b/src/main/java/org/apache/commons/compress/utils/BitInputStream.java
@@ -111,7 +111,7 @@ public class BitInputStream implements Closeable {
      * @since 1.16
      */
     public long bitsAvailable() throws IOException {
-        return bitsCachedSize + 8L * in.available();
+        return bitsCachedSize + ((long) Byte.SIZE) * in.available();
     }
 
     /**
@@ -119,7 +119,7 @@ public class BitInputStream implements Closeable {
      * @since 1.16
      */
     public void alignWithByteBoundary() {
-        int toSkip = bitsCachedSize % 8;
+        int toSkip = bitsCachedSize % Byte.SIZE;
         if (toSkip > 0) {
             readCachedBits(toSkip);
         }
@@ -132,7 +132,7 @@ public class BitInputStream implements Closeable {
 
         // bitsCachedSize >= 57 and left-shifting it 8 bits would cause an overflow
         int bitsToAddCount = count - bitsCachedSize;
-        overflowBits = 8 - bitsToAddCount;
+        overflowBits = Byte.SIZE - bitsToAddCount;
         final long nextByte = in.read();
         if (nextByte < 0) {
             return nextByte;
@@ -180,10 +180,10 @@ public class BitInputStream implements Closeable {
             if (byteOrder == ByteOrder.LITTLE_ENDIAN) {
                 bitsCached |= (nextByte << bitsCachedSize);
             } else {
-                bitsCached <<= 8;
+                bitsCached <<= Byte.SIZE;
                 bitsCached |= nextByte;
             }
-            bitsCachedSize += 8;
+            bitsCachedSize += Byte.SIZE;
         }
         return false;
     }