Class LongArrayMappedTrieMath
java.lang.Object
org.javimmutable.collections.common.LongArrayMappedTrieMath
Utility class that supports math related to Array Mapped Tries with
long hash codes and 64 element arrays. All of the methods are static
and short so they should wind up being inlined by compiler or jit.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final int -
Method Summary
Modifier and TypeMethodDescriptionstatic longbaseIndexAtShift(int shiftCount, long hashCode) static longbaseIndexFromHashCode(long hashCode) static intfindMaxCommonShift(int maxAllowedShift, long hashCode1, long hashCode2) static intfindMaxShiftForHashCode(long hashCode) static intfindMinimumShiftForZeroBelowHashCode(long hashCode) static longhash(int... values) static longhashCodeBelowShift(int shiftCount, long hashCode) static StringhashString(long hashCode) static intindexAtShift(int shiftCount, long hashCode) static intindexFromHashCode(long hashCode) static longliftedHashCode(long hashCode, int index) static intmaxShiftsForBitCount(int bitCount) static longremainderFromHashCode(long hashCode) static longshift(int shiftCount, long value) static longwithIndexAtShift(int shiftCount, long hashCode, int index)
-
Field Details
-
MAX_SHIFTS
public static final int MAX_SHIFTS -
MAX_FULL_SHIFTS
public static final int MAX_FULL_SHIFTS -
MAX_SHIFT_NUMBER
public static final int MAX_SHIFT_NUMBER -
MAX_FULL_SHIFT_NUMBER
public static final int MAX_FULL_SHIFT_NUMBER
-
-
Method Details
-
baseIndexFromHashCode
public static long baseIndexFromHashCode(long hashCode) -
remainderFromHashCode
public static long remainderFromHashCode(long hashCode) -
findMaxCommonShift
public static int findMaxCommonShift(int maxAllowedShift, long hashCode1, long hashCode2) -
indexFromHashCode
public static int indexFromHashCode(long hashCode) -
liftedHashCode
public static long liftedHashCode(long hashCode, int index) -
maxShiftsForBitCount
public static int maxShiftsForBitCount(int bitCount) -
indexAtShift
public static int indexAtShift(int shiftCount, long hashCode) -
baseIndexAtShift
public static long baseIndexAtShift(int shiftCount, long hashCode) -
withIndexAtShift
public static long withIndexAtShift(int shiftCount, long hashCode, int index) -
hashCodeBelowShift
public static long hashCodeBelowShift(int shiftCount, long hashCode) -
findMinimumShiftForZeroBelowHashCode
public static int findMinimumShiftForZeroBelowHashCode(long hashCode) -
findMaxShiftForHashCode
public static int findMaxShiftForHashCode(long hashCode) -
shift
public static long shift(int shiftCount, long value) -
hash
public static long hash(int... values) -
hashString
-