You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by te...@apache.org on 2011/08/23 01:43:14 UTC

svn commit: r1160502 - in /hbase/trunk: CHANGES.txt src/main/java/org/apache/hadoop/hbase/util/Bytes.java

Author: tedyu
Date: Mon Aug 22 23:43:13 2011
New Revision: 1160502

URL: http://svn.apache.org/viewvc?rev=1160502&view=rev
Log:
HBASE-4239  HBASE-4012 introduced duplicate variable Bytes.LONG_BYTES

Modified:
    hbase/trunk/CHANGES.txt
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/Bytes.java

Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1160502&r1=1160501&r2=1160502&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Mon Aug 22 23:43:13 2011
@@ -208,6 +208,7 @@ Release 0.91.0 - Unreleased
                (Brock Noland)
    HBASE-4167  Potential leak of HTable instances when using HTablePool with
                PoolType.ThreadLocal (Karthick Sankarachary)
+   HBASE-4239  HBASE-4012 introduced duplicate variable Bytes.LONG_BYTES
 
   IMPROVEMENTS
    HBASE-3290  Max Compaction Size (Nicolas Spiegelberg via Stack)  

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/Bytes.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/Bytes.java?rev=1160502&r1=1160501&r2=1160502&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/Bytes.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/Bytes.java Mon Aug 22 23:43:13 2011
@@ -972,12 +972,6 @@ public class Bytes {
       compareTo(buffer1, offset1, length1, buffer2, offset2, length2);
   }
   
-  /**
-   * The number of bytes required to represent a primitive {@code long}
-   * value.
-   */
-  public static final int LONG_BYTES = Long.SIZE / Byte.SIZE;
- 
   interface Comparer<T> {
     abstract public int compareTo(T buffer1, int offset1, int length1,
         T buffer2, int offset2, int length2);
@@ -1113,7 +1107,7 @@ public class Bytes {
           return 0;
         }
         int minLength = Math.min(length1, length2);
-        int minWords = minLength / LONG_BYTES;
+        int minWords = minLength / SIZEOF_LONG;
         int offset1Adj = offset1 + BYTE_ARRAY_BASE_OFFSET;
         int offset2Adj = offset2 + BYTE_ARRAY_BASE_OFFSET;
 
@@ -1122,7 +1116,7 @@ public class Bytes {
          * time is no slower than comparing 4 bytes at a time even on 32-bit.
          * On the other hand, it is substantially faster on 64-bit.
          */
-        for (int i = 0; i < minWords * LONG_BYTES; i += LONG_BYTES) {
+        for (int i = 0; i < minWords * SIZEOF_LONG; i += SIZEOF_LONG) {
           long lw = theUnsafe.getLong(buffer1, offset1Adj + (long) i);
           long rw = theUnsafe.getLong(buffer2, offset2Adj + (long) i);
           long diff = lw ^ rw;
@@ -1157,7 +1151,7 @@ public class Bytes {
         }
 
         // The epilogue to cover the last (minLength % 8) elements.
-        for (int i = minWords * LONG_BYTES; i < minLength; i++) {
+        for (int i = minWords * SIZEOF_LONG; i < minLength; i++) {
           int a = (buffer1[offset1 + i] & 0xff);
           int b = (buffer2[offset2 + i] & 0xff);
           if (a != b) {