#include <cassert>
#include <set>
#include <string>
#include <vector>
#include "Benzene.hpp"
#include "Types.hpp"
#include <bitset>
Go to the source code of this file.
Namespaces | |
namespace | BitsetUtil |
Utilities on bitsets. | |
Defines | |
#define | USE_HOMEBREWED_BITSET 1 |
If true, uses our own bitset, otherwise std::bitset. | |
Typedefs | |
typedef benzene_bitset < BITSETSIZE > | bitset_t |
Standard-sized bitset. | |
Functions | |
void | BitsetUtil::BitsetToBytes (const bitset_t &b, byte *out, int numbits) |
Converts the bottom numbits of b into a byte stream. | |
bitset_t | BitsetUtil::BytesToBitset (const byte *bytes, int numbits) |
Converts a byte stream into a bitset. | |
std::string | BitsetUtil::BitsetToHex (const bitset_t &b, int numbits) |
Converts a bitset into a string of hex symbols. | |
bitset_t | BitsetUtil::HexToBitset (const std::string &str) |
Converts a string of hex symbols into a bitset. | |
bitset_t | BitsetUtil::Subtract (const bitset_t &b1, const bitset_t &b2) |
Subtracts b2 from b1. | |
bool | BitsetUtil::SubtractIfLeavesAny (bitset_t &removeFrom, const bitset_t &remove) |
If removeFrom - remove is not empty, stores that value in removeFrom and returns true. | |
bool | BitsetUtil::IsSubsetOf (const bitset_t &b1, const bitset_t &b2) |
Returns true if b1 is a subset of b2. | |
bool | BitsetUtil::IsLessThan (const bitset_t &b1, const bitset_t &b2) |
Returns true if b1 comes before b2 in some consistent order (any well defined ordering, not necessarily lexicographic). | |
template<typename INT > | |
void | BitsetUtil::BitsetToVector (const bitset_t &b, std::vector< INT > &indices) |
Stores indices of set bits in b in indices. | |
template<typename INT > | |
bitset_t | BitsetUtil::SetToBitset (const std::set< INT > &indices) |
Converts of set of indices into a bitset with those bits set. | |
int | BitsetUtil::FindSetBit (const bitset_t &b) |
Returns the bit that is set in b. | |
int | BitsetUtil::FirstSetBit (const bitset_t &b) |
Returns least-significant set bit in b. | |
bitset_t | operator- (const bitset_t &b1, const bitset_t &b2) |
Extends the standard binary '-' operator for bitsets. | |
Variables | |
static _BEGIN_BENZENE_NAMESPACE_ const int | BITSETSIZE = 128 |
Maximum size of a bitset. | |
static const bitset_t | EMPTY_BITSET |
Global empty bitset. |
Definition in file Bitset.hpp.
#define USE_HOMEBREWED_BITSET 1 |
If true, uses our own bitset, otherwise std::bitset.
Homebrewed bitset is a copy of std::bitset with subset and less-than operations built in. Using the homebrewed bitset should improve performance slightly.
If you are getting compile errors, switch to the stl bitset.
Definition at line 25 of file Bitset.hpp.
typedef benzene_bitset<BITSETSIZE> bitset_t |
Standard-sized bitset.
Definition at line 66 of file Bitset.hpp.
Extends the standard binary '-' operator for bitsets.
_BEGIN_BENZENE_NAMESPACE_ const int BITSETSIZE = 128 [static] |
Maximum size of a bitset.
Very important. Only mess with this if you know what you are doing! Fits 11x11 exactly.
Definition at line 59 of file Bitset.hpp.
Referenced by GraphUtils::BFS(), BitsetUtil::BitsetToVector(), DfsCommands::CmdGetState(), ZobristHash::Compute(), TwoDistance::ComputeScores(), Resistance::ComputeScores(), VCSetUtil::ComputeStatistics(), HexUctPolicy::InitializeForSearch(), BitsetUtil::IsLessThan(), DfsSolver::Solve(), and ZobristHash::Update().
const bitset_t EMPTY_BITSET [static] |
Global empty bitset.
Definition at line 69 of file Bitset.hpp.
Referenced by InferiorCells::AddReversibleFrom(), VCBuilder::ComputeCapturedSets(), VCUtils::GetMustplay(), DfsSolver::HandleProof(), and StoneBoard::Write().