Murl Engine Lua Addon API  Version 1.0 beta
Murl.Bitfield

The bitfield class.


Table members

Functions


Murl.Bitfield.new()

The default constructor. Create an empty bitfield.

Murl.Bitfield new()

Returns
Murl.Bitfield


Methods


Empty()

Empty the bitfield.

Empty()


Set(bitIndex)

Set a bit in the bitfield. Extends the bitfield if the bitIndex is greater than the current number of bits, new bits are set to zero.

Set(Integer bitIndex)

Parameters
bitIndexThe zero based index of the bit to set.

Clear(bitIndex)

Clear a bit in the bitfield. Extends the bitfield if the bitIndex is greater than the current number of bits, new bits are set to zero.

Clear(Integer bitIndex)

Parameters
bitIndexThe zero based index of the bit to clear.

IsSet(bitIndex)

Check if a bit is set in the bitfield.

Boolean IsSet(Integer bitIndex)

Parameters
bitIndexThe zero based index of the bit to test.
Returns
Boolean true if the bit is set, false if the index is out of range.

IsCleared(bitIndex)

Check if a bit is cleared in the bitfield.

Boolean IsCleared(Integer bitIndex)

Parameters
bitIndexThe zero based index of the bit to test.
Returns
Boolean true if the bit is cleared or the index is out of range.

GetBitsCount()

Get the number of allocated bits in the bitfield.

Integer GetBitsCount()

Returns
Integer The number of allocated bits in the bitfield.

SetBitsCount(numBits)

Set the number of bits in the bitfield. The bitfield is allocated in 32-bit steps, if the bitfield is extended, the new bits are set to zero.

Integer SetBitsCount(Integer numBits)

Parameters
numBitsThe new number of bits in the bitfield.
Returns
Integer The number of allocated bits in the bitfield.

GetByteSize()

Get the byte size of the bitfield.

Integer GetByteSize()

Returns
Integer The number of bytes used by the bitfield.