Package net.pl3x.map.core.util
Class MCAMath
java.lang.Object
net.pl3x.map.core.util.MCAMath
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic 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 invalue
.
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.
-
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 invalue
.
The value is treated as an unsigned byte. -
ceilLog2
public static int ceilLog2(int n)
-