Package com.jogamp.common.util
Class Bitfield.Util
java.lang.Object
com.jogamp.common.util.Bitfield.Util
- Enclosing interface:
- Bitfield
Bit operation utilities (static).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final intbitCount(int n) Returns the number of set bits within given 32bit integer in O(1) using a HAKEM 169 Bit Count inspired implementation:static intgetBitMask(int n) Returns the 32 bit mask of n-bits, i.e.
-
Constructor Details
-
Util
public Util()
-
-
Method Details
-
getBitMask
public static int getBitMask(int n) Returns the 32 bit mask of n-bits, i.e. n low order 1’s.Implementation handles n == 32.
- Throws:
IndexOutOfBoundsException- ifbis out of bounds, i.e. > 32
-
bitCount
public static final int bitCount(int n) Returns the number of set bits within given 32bit integer in O(1) using a HAKEM 169 Bit Count inspired implementation:http://www.inwap.com/pdp10/hbaker/hakmem/hakmem.html http://home.pipeline.com/~hbaker1/hakmem/hacks.html#item169 http://tekpool.wordpress.com/category/bit-count/ http://www.hackersdelight.org/
-