| java.lang.Object org.apache.solr.util.BitUtil
BitUtil | public class BitUtil (Code) | | A variety of high efficiencly bit twiddling routines.
author: yonik version: $Id$ |
Field Summary | |
final public static byte[] | ntzTable |
Method Summary | |
public static boolean | isPowerOfTwo(int v) | public static boolean | isPowerOfTwo(long v) | public static int | nextHighestPowerOfTwo(int v) | public static long | nextHighestPowerOfTwo(long v) | public static int | ntz(long val) Returns number of trailing zeros in the 64 bit long value. | public static int | ntz2(long x) | public static int | ntz3(long x) | public static int | pop(long x) | public static long | pop_andnot(long A, long B, int wordOffset, int numWords) Returns the popcount or cardinality of A & ~B
Neither array is modified. | public static long | pop_array(long A, int wordOffset, int numWords) Returns the number of set bits in an array of longs. | public static long | pop_intersect(long A, long B, int wordOffset, int numWords) Returns the popcount or cardinality of the two sets after an intersection. | public static long | pop_union(long A, long B, int wordOffset, int numWords) Returns the popcount or cardinality of the union of two sets. | public static long | pop_xor(long A, long B, int wordOffset, int numWords) |
ntzTable | final public static byte[] ntzTable(Code) | | table of number of trailing zeros in a byte
|
isPowerOfTwo | public static boolean isPowerOfTwo(int v)(Code) | | returns true if v is a power of two or zero
|
isPowerOfTwo | public static boolean isPowerOfTwo(long v)(Code) | | returns true if v is a power of two or zero
|
nextHighestPowerOfTwo | public static int nextHighestPowerOfTwo(int v)(Code) | | returns the next highest power of two, or the current value if it's already a power of two or zero
|
nextHighestPowerOfTwo | public static long nextHighestPowerOfTwo(long v)(Code) | | returns the next highest power of two, or the current value if it's already a power of two or zero
|
ntz | public static int ntz(long val)(Code) | | Returns number of trailing zeros in the 64 bit long value.
|
ntz2 | public static int ntz2(long x)(Code) | | returns 0 based index of first set bit
(only works for x!=0)
This is an alternate implementation of ntz()
|
ntz3 | public static int ntz3(long x)(Code) | | returns 0 based index of first set bit
This is an alternate implementation of ntz()
|
pop | public static int pop(long x)(Code) | | Returns the number of bits set in the long
|
pop_andnot | public static long pop_andnot(long A, long B, int wordOffset, int numWords)(Code) | | Returns the popcount or cardinality of A & ~B
Neither array is modified.
|
pop_array | public static long pop_array(long A, int wordOffset, int numWords)(Code) | | Returns the number of set bits in an array of longs.
|
pop_intersect | public static long pop_intersect(long A, long B, int wordOffset, int numWords)(Code) | | Returns the popcount or cardinality of the two sets after an intersection.
Neither array is modified.
|
pop_union | public static long pop_union(long A, long B, int wordOffset, int numWords)(Code) | | Returns the popcount or cardinality of the union of two sets.
Neither array is modified.
|
pop_xor | public static long pop_xor(long A, long B, int wordOffset, int numWords)(Code) | | |
|
|