BitUint32Extension extension

Bit twiddling extensions on unsigned 32-bit integers.

Loosely based on http://graphics.stanford.edu/~seander/bithacks.html.

on

Properties

bitCeil → int

Available on int, provided by the BitUint32Extension extension

Returns the power of 2 that is greater or equal to this unsigned 32-bit integer.
no setter
bitCount → int

Available on int, provided by the BitUint32Extension extension

Returns the number of set bits of an unsigned 32-bit integer. This value is also known as "binary weight" or "Hamming weight".
no setter
bitFloor → int

Available on int, provided by the BitUint32Extension extension

Returns the power of 2 that is smaller or equal to this unsigned 32-bit integer.
no setter
hasSingleBit → bool

Available on int, provided by the BitUint32Extension extension

Tests if this unsigned 32-bit integer has a single bit set, which also means that it is a power of two.
no setter

Methods

clearBit(int index) → int

Available on int, provided by the BitUint32Extension extension

Returns this unsigned 32-bit integer with the bit at index cleared.
setBit(int index) → int

Available on int, provided by the BitUint32Extension extension

Returns this unsigned 32-bit integer with the bit at index set.
toggleBit(int index) → int

Available on int, provided by the BitUint32Extension extension

Returns this unsigned 32-bit integer with the bit at index toggled.