Top Description Constructors Methods
com.carrotsearch.hppc

pack-priv final Class BitUtil

extends Object
Class Inheritance

A variety of high efficiency bit twiddling routines.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public 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

public 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

public static long
pop_andnot(long[] arr1, long[] arr2, int wordOffset, int numWords)

Returns the popcount or cardinality of A & ~B.

public static long
pop_array(long[] arr, int wordOffset, int numWords)

Returns the number of set bits in an array of longs.

public static long
pop_intersect(long[] arr1, long[] arr2, int wordOffset, int numWords)

Returns the popcount or cardinality of the two sets after an intersection.

public static long
pop_union(long[] arr1, long[] arr2, int wordOffset, int numWords)

Returns the popcount or cardinality of the union of two sets.

public static long
pop_xor(long[] arr1, long[] arr2, int wordOffset, int numWords)

Returns the popcount or cardinality of A ^ B Neither array is modified.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

BitUtilback to summary
private BitUtil()

Method Detail

nextHighestPowerOfTwoback to summary
public 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

nextHighestPowerOfTwoback to summary
public 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

pop_andnotback to summary
public static long pop_andnot(long[] arr1, long[] arr2, int wordOffset, int numWords)

Returns the popcount or cardinality of A & ~B. Neither array is modified.

pop_arrayback to summary
public static long pop_array(long[] arr, int wordOffset, int numWords)

Returns the number of set bits in an array of longs.

pop_intersectback to summary
public static long pop_intersect(long[] arr1, long[] arr2, int wordOffset, int numWords)

Returns the popcount or cardinality of the two sets after an intersection. Neither array is modified.

pop_unionback to summary
public static long pop_union(long[] arr1, long[] arr2, int wordOffset, int numWords)

Returns the popcount or cardinality of the union of two sets. Neither array is modified.

pop_xorback to summary
public static long pop_xor(long[] arr1, long[] arr2, int wordOffset, int numWords)

Returns the popcount or cardinality of A ^ B Neither array is modified.