Class BitmaskMath

java.lang.Object
org.javimmutable.collections.common.BitmaskMath

public final class BitmaskMath extends Object
Helper class with static methods to manipulate long bitmasks. Used in array map trie calculations. Methods are short to allow inlining.
  • Field Details

  • Method Details

    • bitFromIndex

      public static long bitFromIndex(int index)
    • bitIsAbsent

      public static boolean bitIsAbsent(long bitmask, long bit)
    • bitIsPresent

      public static boolean bitIsPresent(long bitmask, long bit)
    • addBit

      public static long addBit(long bitmask, long bit)
    • removeBit

      public static long removeBit(long bitmask, long bit)
    • leastBit

      public static long leastBit(long bitmask)
    • indexForBit

      public static int indexForBit(long bit)
    • arrayIndexForBit

      public static int arrayIndexForBit(long bitmask, long bit)
    • bitCount

      public static int bitCount(long bitmask)
    • indices

      @Nonnull public static Indexed<Integer> indices(long bitmask)
    • forEachIndex

      public static void forEachIndex(long bitmask, java.util.function.IntConsumer proc)
    • copyToCompactArrayUsingBitmask

      public static <S, D> void copyToCompactArrayUsingBitmask(long bitmask, @Nonnull S[] source, @Nonnull D[] dest, @Nonnull java.util.function.Function<S,D> transforminator)
    • bitmask

      public static long bitmask(int... indices)