nxt.bitop_ex

Various extensions to core.bitop and std.bitmanip.

Members

Functions

getHighestBit
bool getHighestBit(T a)

Get highest bit of a.

getLowestBit
bool getLowestBit(T a)

Get lowest bit of a.

makeBit
T makeBit(I bixs)
resetBit
void resetBit(T a, I bixs)

Reset bits I of a (to zero).

resetBit
void resetBit(T* a, I bixs)

Reset bits I of *a (to zero).

resetBit
void resetBit(T a, I bixs)

Reset bits I of a (to zero).

resetHighestBit
void resetHighestBit(T a)

Reset highest bit of a (to zero).

resetLowestBit
void resetLowestBit(T a)

Reset lowest bit of a (to zero).

setBit
void setBit(T a, I bixs)

Test and sets the bix:th bit of a to one. * * Returns: A non-zero value if the bit was set, and a zero if it was clear.

setBit
void setBit(T* a, I bixs)

Sets the bix:th bit of *a to one.

setBit
void setBit(T a, I bixs)

Sets the bix:th bit of *a to one.

setHighestBit
void setHighestBit(T a)

Set highest bit of a to one.

setLowestBit
void setLowestBit(T a)

Set lowest bit of a to one.

testBit
bool testBit(T a, I bixs)
testBit
bool testBit(T a, I bixs)
testBit
bool testBit(T* a, I bixs)

Templates

UnsignedOfSameSizeAs
template UnsignedOfSameSizeAs(T)

Get an unsigned type of size as T if possible.

Meta

Authors

TODO Add range checking of bit indexes.

TODO Make use of TZCNT and LZCNT either as inline assembly or as builtins: https://github.com/dlang/dmd/pull/6364