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
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
-
Method Summary
Modifier and TypeMethodDescriptionstatic long
baseIndexAtShift
(int shiftCount, long hashCode) static long
baseIndexFromHashCode
(long hashCode) static int
findMaxCommonShift
(int maxAllowedShift, long hashCode1, long hashCode2) static int
findMaxShiftForHashCode
(long hashCode) static int
findMinimumShiftForZeroBelowHashCode
(long hashCode) static long
hash
(int... values) static long
hashCodeBelowShift
(int shiftCount, long hashCode) static String
hashString
(long hashCode) static int
indexAtShift
(int shiftCount, long hashCode) static int
indexFromHashCode
(long hashCode) static long
liftedHashCode
(long hashCode, int index) static int
maxShiftsForBitCount
(int bitCount) static long
remainderFromHashCode
(long hashCode) static long
shift
(int shiftCount, long value) static long
withIndexAtShift
(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
-