26 #define SHARE_VM_CLASSFILE_ALTHASHING_HPP 27 28 #include "jni.h" 29 #include "classfile/symbolTable.hpp" 30 31 /** 32 * Hashing utilities. 33 * 34 * Implementation of Murmur3 hashing. 35 * This code was translated from src/share/classes/sun/misc/Hashing.java 36 * code in the JDK. 37 */ 38 39 class AltHashing : AllStatic { 40 friend class AltHashingTest; 41 42 // utility function copied from java/lang/Integer 43 static juint Integer_rotateLeft(juint i, int distance) { 44 return (i << distance) | (i >> (32 - distance)); 45 } 46 static juint murmur3_32(const int* data, int len); 47 static juint murmur3_32(juint seed, const int* data, int len); 48 49 public: 50 static juint compute_seed(); 51 static juint murmur3_32(juint seed, const jbyte* data, int len); 52 static juint murmur3_32(juint seed, const jchar* data, int len); 53 }; 54 #endif // SHARE_VM_CLASSFILE_ALTHASHING_HPP | 26 #define SHARE_VM_CLASSFILE_ALTHASHING_HPP 27 28 #include "jni.h" 29 #include "classfile/symbolTable.hpp" 30 31 /** 32 * Hashing utilities. 33 * 34 * Implementation of Murmur3 hashing. 35 * This code was translated from src/share/classes/sun/misc/Hashing.java 36 * code in the JDK. 37 */ 38 39 class AltHashing : AllStatic { 40 friend class AltHashingTest; 41 42 // utility function copied from java/lang/Integer 43 static juint Integer_rotateLeft(juint i, int distance) { 44 return (i << distance) | (i >> (32 - distance)); 45 } 46 static juint murmur3_32(const jint* data, int len); 47 static juint murmur3_32(juint seed, const jint* data, int len); 48 49 public: 50 static juint compute_seed(); 51 static juint murmur3_32(juint seed, const jbyte* data, int len); 52 static juint murmur3_32(juint seed, const jchar* data, int len); 53 }; 54 #endif // SHARE_VM_CLASSFILE_ALTHASHING_HPP |