in graphjet-core/src/main/java/com/twitter/graphjet/hashing/IntToIntPairConcurrentHashMap.java [222:238]
private int getKeyPosition(int key, ReaderAccessibleInfo currentReaderAccessibleInfo) {
long primaryHash = primaryHashFunction(key);
int hashedValue = (int) (primaryHash & currentReaderAccessibleInfo.bitMask);
int position = hashedValue * NUM_INTS_PER_KEY;
long currentKey = currentReaderAccessibleInfo.array.getEntry(position);
if ((currentKey == defaultReturnValue) || (currentKey == key)) {
return position;
}
int secondaryHash = secondaryHashFunction(key, currentReaderAccessibleInfo.bitMask);
do {
hashedValue =
(int) (((long) hashedValue + secondaryHash) & currentReaderAccessibleInfo.bitMask);
position = hashedValue * NUM_INTS_PER_KEY;
currentKey = currentReaderAccessibleInfo.array.getEntry(position);
} while ((currentKey != defaultReturnValue) && (currentKey != key));
return position;
}