1818 * Modified by the gRPC Authors
1919 */
2020
21- package io .grpc .xds ;
21+ package io .grpc .tp . zah ;
2222
2323import static com .google .common .base .Preconditions .checkArgument ;
2424import static com .google .common .base .Preconditions .checkNotNull ;
3333 * <a href="https://github.com/OpenHFT/Zero-Allocation-Hashing/blob/master/src/main/java/net/openhft/hashing/XxHash.java">
3434 * OpenHFT/Zero-Allocation-Hashing</a>.
3535 */
36- final class XxHash64 {
37- static final XxHash64 INSTANCE = new XxHash64 (0 );
36+ final public class XxHash64 {
37+ static public final XxHash64 INSTANCE = new XxHash64 (0 );
3838
3939 // Primes if treated as unsigned
4040 private static final long P1 = -7046029288634856825L ;
@@ -47,12 +47,12 @@ final class XxHash64 {
4747 private final long seed ;
4848 private final long voidHash ;
4949
50- XxHash64 (long seed ) {
50+ public XxHash64 (long seed ) {
5151 this .seed = seed ;
5252 this .voidHash = finalize (seed + P5 );
5353 }
5454
55- long hashLong (long input ) {
55+ public long hashLong (long input ) {
5656 input = byteOrder == ByteOrder .LITTLE_ENDIAN ? input : Long .reverseBytes (input );
5757 long hash = seed + P5 + 8 ;
5858 input *= P2 ;
@@ -63,15 +63,15 @@ long hashLong(long input) {
6363 return finalize (hash );
6464 }
6565
66- long hashInt (int input ) {
66+ public long hashInt (int input ) {
6767 input = byteOrder == ByteOrder .LITTLE_ENDIAN ? input : Integer .reverseBytes (input );
6868 long hash = seed + P5 + 4 ;
6969 hash ^= (input & 0xFFFFFFFFL ) * P1 ;
7070 hash = Long .rotateLeft (hash , 23 ) * P2 + P3 ;
7171 return finalize (hash );
7272 }
7373
74- long hashShort (short input ) {
74+ public long hashShort (short input ) {
7575 input = byteOrder == ByteOrder .LITTLE_ENDIAN ? input : Short .reverseBytes (input );
7676 long hash = seed + P5 + 2 ;
7777 hash ^= (input & 0xFFL ) * P5 ;
@@ -81,22 +81,22 @@ long hashShort(short input) {
8181 return finalize (hash );
8282 }
8383
84- long hashChar (char input ) {
84+ public long hashChar (char input ) {
8585 return hashShort ((short ) input );
8686 }
8787
88- long hashByte (byte input ) {
88+ public long hashByte (byte input ) {
8989 long hash = seed + P5 + 1 ;
9090 hash ^= (input & 0xFF ) * P5 ;
9191 hash = Long .rotateLeft (hash , 11 ) * P1 ;
9292 return finalize (hash );
9393 }
9494
95- long hashVoid () {
95+ public long hashVoid () {
9696 return voidHash ;
9797 }
9898
99- long hashAsciiString (String input ) {
99+ public long hashAsciiString (String input ) {
100100 ByteSupplier supplier = new AsciiStringByteSupplier (input );
101101 return hashBytes (supplier );
102102 }
@@ -106,7 +106,7 @@ long hashBytes(byte[] bytes) {
106106 return hashBytes (supplier );
107107 }
108108
109- long hashBytes (byte [] bytes , int offset , int len ) {
109+ public long hashBytes (byte [] bytes , int offset , int len ) {
110110 ByteSupplier supplier = new PlainByteSupplier (bytes , offset , len );
111111 return hashBytes (supplier );
112112 }
0 commit comments