BitSet

Data Structures View source
BitSet

Source on GitHub

📖 Read the detailed guide for hand-written examples and background.

Tuples

bitset

public tuple bitset(int val)

Bitset represents a fixed-size sequence of BITSET_SIZE bits. The bits are contained in a single int.

Functions

emptyBitset

public function emptyBitset() returns bitset

Creates an empty bitset.

bitsetToIndex

public function bitsetToIndex(bitset object) returns int

bitsetFromIndex

public function bitsetFromIndex(int index) returns bitset

Extension Functions

bitset.get

public function bitset.get(int index) returns bool

Returns the value of the bit with the specified index.

bitset.set

public function bitset.set(int index) returns bitset

Sets the bit at the specified index to true.

bitset.reset

public function bitset.reset(int index) returns bitset

Sets the bit at the specified index to false.

bitset.set

public function bitset.set(int index, bool value) returns bitset

Sets the bit at the specified index to the specified value.

bitset.flip

public function bitset.flip(int index) returns bitset

Sets the bit at the specified index to the complement of its current value.

bitset.isEmpty

public function bitset.isEmpty() returns bool

Returns true if this bitset contains no bits that are set to true.

bitset.intersects

public function bitset.intersects(bitset other) returns bool

Returns true if the specified bitset has any bits set to true that are also set to true in this bitset.

bitset.bitAnd

public function bitset.bitAnd(bitset other) returns bitset

Performs a logical AND of this bit set with the bit set argument.

bitset.bitOr

public function bitset.bitOr(bitset other) returns bitset

Performs a logical OR of this bit set with the bit set argument.

bitset.bitXor

public function bitset.bitXor(bitset other) returns bitset

Performs a logical XOR of this bit set with the bit set argument.

bitset.toInt

public function bitset.toInt() returns int

Returns an integer representation of the data.

Constants

BITSET_SIZE

public constant BITSET_SIZE = 32