Class MCAMath

java.lang.Object
net.pl3x.map.core.util.MCAMath

public class MCAMath extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    ceilLog2(int n)
     
    static int
    getByteHalf(int value, boolean largeHalf)
    Extracts the 4 bits of the left (largeHalf = true) or the right (largeHalf = false) side of the byte stored in value.
    The value is treated as an unsigned byte.
    static long
    getValueFromLongArray(long[] data, int valueIndex, int bitsPerValue)
    Having a long array where each long contains as many values as fit in it without overflowing, returning the "valueIndex"-th value when each value has "bitsPerValue" bits.
    static long
    getValueFromLongStream(long[] data, int valueIndex, int bitsPerValue)
    Treating the long array "data" as a continuous stream of bits, returning the "valueIndex"-th value when each value has "bitsPerValue" bits.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MCAMath

      public MCAMath()
  • Method Details

    • getValueFromLongArray

      public static long getValueFromLongArray(long[] data, int valueIndex, int bitsPerValue)
      Having a long array where each long contains as many values as fit in it without overflowing, returning the "valueIndex"-th value when each value has "bitsPerValue" bits.
    • getValueFromLongStream

      public static long getValueFromLongStream(long[] data, int valueIndex, int bitsPerValue)
      Treating the long array "data" as a continuous stream of bits, returning the "valueIndex"-th value when each value has "bitsPerValue" bits.
    • getByteHalf

      public static int getByteHalf(int value, boolean largeHalf)
      Extracts the 4 bits of the left (largeHalf = true) or the right (largeHalf = false) side of the byte stored in value.
      The value is treated as an unsigned byte.
    • ceilLog2

      public static int ceilLog2(int n)