|
CGAL 6.1 - Homological Discrete Vector Fields
|
#include <CGAL/OSM/Bitboard.h>
The class Bitboard implements an accelerating structure, derived from the chess community.
This structure maps stores a sequence of bits. However, unlike vectors or arrays, it provides fast forward and reverse iterators over 1 bits. It is used in OSM::Sparse_matrix to build a fast iterator over non-zero chains.
Classes | |
| struct | iterator |
| struct | reverse_iterator |
Public Member Functions | |
| Bitboard () | |
| Bitboard default constructor. | |
| Bitboard (const std::vector< std::uint64_t > &_bitboard) | |
| Bitboard value intializer. | |
| Bitboard (const std::size_t _size, bool empty=true) | |
| Bitboard size initializer. | |
| Bitboard (const Bitboard &_bitboard) | |
| Bitboard copy constructor. | |
| Bitboard & | operator= (const Bitboard &_bitboard) |
| Bitboard assign operator. | |
| Bitboard & | bit_not () |
| Bitwise NOT on a bitboard. | |
| iterator | begin () const |
| Bitboard begin iterator that allows to loop through all non-null indices. | |
| iterator | end () const |
| Bitboard past-the-end iterator. | |
| reverse_iterator | reverse_begin () const |
| Bitboard reverse_begin reverse_iterator that allows to loop through all non-null indices in decreasing order. | |
| reverse_iterator | reverse_begin (size_t index) const |
| reverse_iterator | reverse_end () const |
| Bitboard past-the-end reverse_iterator. | |
| Bitboard & | operator|= (const Bitboard &_other) |
| Bitwise OR between two bitboards. | |
| Bitboard & | operator|= (const std::size_t &_other) |
| Bitwise OR between a bitboard and a single bit at given position. | |
| Bitboard & | operator&= (const Bitboard &_other) |
| Bitwise AND between two bitboards. | |
| Bitboard & | operator&= (const std::size_t &_other) |
| Bitwise AND between a bitboard and a single bit at given position. | |
| Bitboard & | operator^= (const Bitboard &_other) |
| Bitwise XOR between two bitboards. | |
| Bitboard & | operator^= (const std::size_t &_other) |
| Bitwise XOR between a bitboard and a single bit at given position. | |
| void | toggle (const std::size_t &_index) |
| Toggle on and off a given bit. | |
| void | setOn (const std::size_t &_index) |
| Toggle on a given bit. | |
| void | setOff (const std::size_t &_index) |
| Toggle off a given bit. | |
| bool | isOn (const std::size_t &_index) const |
| size_t | size () const |
Static Public Member Functions | |
| static std::size_t | bitIndex (std::uint64_t _value) |
| Compute fast 64bit int log2. | |
Friends | |
| Bitboard | operator~ (const Bitboard &_bitboard) |
| Bitwise NOT of a bitboard. | |
| std::ostream & | operator<< (std::ostream &_stream, const Bitboard &_bitboard) |
| Stream operator that displays all bits. | |
| Bitboard | operator| (const Bitboard &_left, const Bitboard &_right) |
| Bitwise OR between two bitboards. | |
| Bitboard | operator| (const Bitboard &_left, const std::size_t &_right) |
| Bitwise OR between a bitboard and a single bit at given position. | |
| Bitboard | operator| (const std::size_t &_left, const Bitboard &_right) |
| Bitwise OR between a bitboard and a single bit at given position. | |
| Bitboard | operator& (const Bitboard &_left, const Bitboard &_right) |
| Bitwise AND between two bitboards. | |
| Bitboard | operator& (const Bitboard &_left, const std::size_t &_right) |
| Bitwise AND between a bitboard and a single bit at given position. | |
| Bitboard | operator& (const std::size_t &_left, const Bitboard &_right) |
| Bitwise AND between a bitboard and a single bit at given position. | |
| Bitboard | operator^ (const Bitboard &_left, const Bitboard &_right) |
| Bitwise XOR between two bitboards. | |
| Bitboard | operator^ (const Bitboard &_left, const std::size_t &_right) |
| Bitwise XOR between a bitboard and a single bit at given position. | |
| Bitboard | operator^ (const std::size_t &_left, const Bitboard &_right) |
| Bitwise XOR between a bitboard and a single bit at given position. | |
| CGAL::OSM::Bitboard::Bitboard | ( | ) |
Bitboard default constructor.
Initialize bitboard with all zeros and size 64.
| CGAL::OSM::Bitboard::Bitboard | ( | const std::vector< std::uint64_t > & | _bitboard | ) |
Bitboard value intializer.
Initialize bitboard with given vector of bitboards.
| [in] | _bitboard | The vector of 64bit ints. |
| CGAL::OSM::Bitboard::Bitboard | ( | const std::size_t | _size, |
| bool | empty = true |
||
| ) |
Bitboard size initializer.
Initialize bitboard with given size.
| [in] | _size | The size of the bitboard. |
| [in] | empty | If the boolean is true, create an empty bitboard (all bits set to 0), otherwise create a full bitboard (all bits set to 1). |
| CGAL::OSM::Bitboard::Bitboard | ( | const Bitboard & | _bitboard | ) |
Bitboard copy constructor.
Initialize bitboard with given bitboard.
| [in] | _bitboard | The bitboard to copy. |
| iterator CGAL::OSM::Bitboard::begin | ( | ) | const |
Bitboard begin iterator that allows to loop through all non-null indices.
| Bitboard & CGAL::OSM::Bitboard::bit_not | ( | ) |
Bitwise NOT on a bitboard.
|
static |
Compute fast 64bit int log2.
| [in] | _value | The value we want to get the bit index (i.e. log2). |
| iterator CGAL::OSM::Bitboard::end | ( | ) | const |
Bitwise AND between two bitboards.
| [in] | _other | The other bitboard. |
| Bitboard & CGAL::OSM::Bitboard::operator&= | ( | const std::size_t & | _other | ) |
Bitwise AND between a bitboard and a single bit at given position.
| [in] | _other | The bit position. |
Bitboard assign operator.
Initialize bitboard with given bitboard.
| [in] | _bitboard | The bitboard to copy. |
Bitwise XOR between two bitboards.
| [in] | _other | The other bitboard. |
| Bitboard & CGAL::OSM::Bitboard::operator^= | ( | const std::size_t & | _other | ) |
Bitwise XOR between a bitboard and a single bit at given position.
| [in] | _other | The bit position. |
Bitwise OR between two bitboards.
| [in] | _other | The other bitboard. |
| Bitboard & CGAL::OSM::Bitboard::operator|= | ( | const std::size_t & | _other | ) |
Bitwise OR between a bitboard and a single bit at given position.
| [in] | _other | The bit position. |
| reverse_iterator CGAL::OSM::Bitboard::reverse_begin | ( | ) | const |
Bitboard reverse_begin reverse_iterator that allows to loop through all non-null indices in decreasing order.
| reverse_iterator CGAL::OSM::Bitboard::reverse_end | ( | ) | const |
Bitboard past-the-end reverse_iterator.
| void CGAL::OSM::Bitboard::setOff | ( | const std::size_t & | _index | ) |
Toggle off a given bit.
| [in] | _index | The bit position. |
| void CGAL::OSM::Bitboard::setOn | ( | const std::size_t & | _index | ) |
Toggle on a given bit.
| [in] | _index | The bit position. |
| void CGAL::OSM::Bitboard::toggle | ( | const std::size_t & | _index | ) |
Toggle on and off a given bit.
| [in] | _index | The bit position. |
Bitwise AND between two bitboards.
| [in] | _left | The left hand side. |
| [in] | _right | The right hand side. |
Bitwise AND between a bitboard and a single bit at given position.
| [in] | _left | The left hand side. |
| [in] | _right | The right hand side. |
Bitwise AND between a bitboard and a single bit at given position.
| [in] | _left | The left hand side. |
| [in] | _right | The right hand side. |
|
friend |
Stream operator that displays all bits.
| [in,out] | _stream | The stream to edit. |
| [in] | _bitboard | The bitboard to display. |
Bitwise XOR between two bitboards.
| [in] | _left | The left hand side. |
| [in] | _right | The right hand side. |
Bitwise XOR between a bitboard and a single bit at given position.
| [in] | _left | The left hand side. |
| [in] | _right | The right hand side. |
Bitwise XOR between a bitboard and a single bit at given position.
| [in] | _left | The left hand side. |
| [in] | _right | The right hand side. |
Bitwise OR between two bitboards.
| [in] | _left | The left hand side. |
| [in] | _right | The right hand side. |
Bitwise OR between a bitboard and a single bit at given position.
| [in] | _left | The left hand side. |
| [in] | _right | The right hand side. |
Bitwise OR between a bitboard and a single bit at given position.
| [in] | _left | The left hand side. |
| [in] | _right | The right hand side. |