commit
40cc7e2aad
|
@ -30,7 +30,7 @@ import sun.misc.Unsafe;
|
|||
|
||||
/**
|
||||
* Utility code to do optimized byte-array comparison.
|
||||
* This is borrowed and slightly modified from Guava's {@link UnsignedBytes}
|
||||
* This is borrowed and slightly modified from Guava's UnsignedBytes
|
||||
* class to be able to compare arrays that start at non-zero offsets.
|
||||
*/
|
||||
abstract class FastByteComparisons {
|
||||
|
@ -38,14 +38,14 @@ abstract class FastByteComparisons {
|
|||
private static final int UNSIGNED_MASK = 0xFF;
|
||||
/**
|
||||
* Lexicographically compare two byte arrays.
|
||||
*
|
||||
*
|
||||
* @param buffer1 left operand, expected to not be null
|
||||
* @param buffer2 right operand, expected to not be null
|
||||
* @param offset1 Where to start comparing in the left buffer, expected to be >= 0
|
||||
* @param offset2 Where to start comparing in the right buffer, expected to be >= 0
|
||||
* @param length1 How much to compare from the left buffer, expected to be >= 0
|
||||
* @param length2 How much to compare from the right buffer, expected to be >= 0
|
||||
* @return 0 if equal, < 0 if left is less than right, etc.
|
||||
* @param offset1 Where to start comparing in the left buffer, expected to be >= 0
|
||||
* @param offset2 Where to start comparing in the right buffer, expected to be >= 0
|
||||
* @param length1 How much to compare from the left buffer, expected to be >= 0
|
||||
* @param length2 How much to compare from the right buffer, expected to be >= 0
|
||||
* @return 0 if equal, < 0 if left is less than right, etc.
|
||||
*/
|
||||
public static int compareTo(byte[] buffer1, int offset1, int length1,
|
||||
byte[] buffer2, int offset2, int length2) {
|
||||
|
@ -59,7 +59,7 @@ abstract class FastByteComparisons {
|
|||
interface Comparer<T> extends Comparator<T> {
|
||||
/**
|
||||
* Lexicographically compare two byte arrays.
|
||||
*
|
||||
*
|
||||
* @param buffer1 left operand
|
||||
* @param buffer2 right operand
|
||||
* @param offset1 Where to start comparing in the left buffer
|
||||
|
@ -291,4 +291,4 @@ abstract class FastByteComparisons {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue