|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.lucene.util.BitUtil
public final class BitUtil
A variety of high efficiency bit twiddling routines.
Field Summary | |
---|---|
static byte[] |
nlzTable
table of number of leading zeros in a byte |
static byte[] |
ntzTable
table of number of trailing zeros in a byte |
Method Summary | |
---|---|
static boolean |
isPowerOfTwo(int v)
returns true if v is a power of two or zero |
static boolean |
isPowerOfTwo(long v)
returns true if v is a power of two or zero |
static int |
nextHighestPowerOfTwo(int v)
returns the next highest power of two, or the current value if it's already a power of two or zero |
static long |
nextHighestPowerOfTwo(long v)
returns the next highest power of two, or the current value if it's already a power of two or zero |
static int |
nlz(long x)
Returns the number of leading zero bits. |
static int |
ntz(int val)
Returns number of trailing zeros in a 32 bit int value. |
static int |
ntz(long val)
Returns number of trailing zeros in a 64 bit long value. |
static int |
ntz2(long x)
returns 0 based index of first set bit (only works for x!=0) This is an alternate implementation of ntz() |
static int |
ntz3(long x)
returns 0 based index of first set bit This is an alternate implementation of ntz() |
static long |
pop_andnot(long[] A,
long[] B,
int wordOffset,
int numWords)
Returns the popcount or cardinality of A & ~B Neither array is modified. |
static long |
pop_array(long[] A,
int wordOffset,
int numWords)
Returns the number of set bits in an array of longs. |
static long |
pop_intersect(long[] A,
long[] B,
int wordOffset,
int numWords)
Returns the popcount or cardinality of the two sets after an intersection. |
static long |
pop_union(long[] A,
long[] B,
int wordOffset,
int numWords)
Returns the popcount or cardinality of the union of two sets. |
static long |
pop_xor(long[] A,
long[] B,
int wordOffset,
int numWords)
|
static int |
pop(long x)
Returns the number of bits set in the long |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte[] ntzTable
public static final byte[] nlzTable
Method Detail |
---|
public static int pop(long x)
public static long pop_array(long[] A, int wordOffset, int numWords)
public static long pop_intersect(long[] A, long[] B, int wordOffset, int numWords)
public static long pop_union(long[] A, long[] B, int wordOffset, int numWords)
public static long pop_andnot(long[] A, long[] B, int wordOffset, int numWords)
public static long pop_xor(long[] A, long[] B, int wordOffset, int numWords)
public static int ntz(long val)
public static int ntz(int val)
public static int ntz2(long x)
public static int ntz3(long x)
public static int nlz(long x)
public static boolean isPowerOfTwo(int v)
public static boolean isPowerOfTwo(long v)
public static int nextHighestPowerOfTwo(int v)
public static long nextHighestPowerOfTwo(long v)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |