44 }
45
46 // derived class may return Class<? extends HashtableEntry>
47 protected Class getHashtableEntryClass() {
48 return HashtableEntry.class;
49 }
50
51 public int hashToIndex(long fullHash) {
52 return (int) (fullHash % tableSize());
53 }
54
55 public Hashtable(Address addr) {
56 super(addr);
57 }
58
59 // VM's Hashtable::hash_symbol
60 protected static long hashSymbol(byte[] buf) {
61 long h = 0;
62 int s = 0;
63 int len = buf.length;
64 // Emulate the unsigned int in java_lang_String::hash_code
65 while (len-- > 0) {
66 h = 31*h + (0xFFFFFFFFL & buf[s]);
67 s++;
68 }
69 return h & 0xFFFFFFFFL;
70 }
71 }
|
44 }
45
46 // derived class may return Class<? extends HashtableEntry>
47 protected Class getHashtableEntryClass() {
48 return HashtableEntry.class;
49 }
50
51 public int hashToIndex(long fullHash) {
52 return (int) (fullHash % tableSize());
53 }
54
55 public Hashtable(Address addr) {
56 super(addr);
57 }
58
59 // VM's Hashtable::hash_symbol
60 protected static long hashSymbol(byte[] buf) {
61 long h = 0;
62 int s = 0;
63 int len = buf.length;
64 while (len-- > 0) {
65 h = 31*h + (0xFFL & buf[s]);
66 s++;
67 }
68 return h & 0xFFFFFFFFL;
69 }
70 }
|