Package org.terrier.compression.bit
Class BitUtilities
- java.lang.Object
-
- org.terrier.compression.bit.BitUtilities
-
public class BitUtilities extends java.lang.Object
Utility methods for use in the BitFile classes.- Since:
- 2.0
- Author:
- Craig Macdonald
-
-
Field Summary
Fields Modifier and Type Field Description static int[]
MSB_BYTES
Array of output of mostSignficantBit(byte) for quicker lookups
-
Constructor Summary
Constructors Constructor Description BitUtilities()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
mostSignficantBit_Loop(int x)
Returns the most significant bit for any positive integer, 0 for -1.static int
mostSignificantBit(byte x)
Returns the most significant bit for any byte value.static int
mostSignificantBit(int x)
Returns the most significant bit for any positive integer.
-
-
-
Method Detail
-
mostSignficantBit_Loop
public static int mostSignficantBit_Loop(int x)
Returns the most significant bit for any positive integer, 0 for -1. Computed by iteration
-
mostSignificantBit
public static int mostSignificantBit(int x)
Returns the most significant bit for any positive integer. 0 for -1. Computed by hard-coded binary search.
-
mostSignificantBit
public static int mostSignificantBit(byte x)
Returns the most significant bit for any byte value. 0 gives MSB -1.
-
-