Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

BitsetUtil Namespace Reference

Utilities on bitsets. More...

Functions

void BitsetToBytes (const bitset_t &b, byte *out, int numbits)
 Converts the bottom numbits of b into a byte stream.
bitset_t BytesToBitset (const byte *bytes, int numbits)
 Converts a byte stream into a bitset.
std::string BitsetToHex (const bitset_t &b, int numbits)
 Converts a bitset into a string of hex symbols.
bitset_t HexToBitset (const std::string &str)
 Converts a string of hex symbols into a bitset.
bitset_t Subtract (const bitset_t &b1, const bitset_t &b2)
 Subtracts b2 from b1.
bool SubtractIfLeavesAny (bitset_t &removeFrom, const bitset_t &remove)
 If removeFrom - remove is not empty, stores that value in removeFrom and returns true.
bool IsSubsetOf (const bitset_t &b1, const bitset_t &b2)
 Returns true if b1 is a subset of b2.
bool 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 BitsetToVector (const bitset_t &b, std::vector< INT > &indices)
 Stores indices of set bits in b in indices.
template<typename INT >
bitset_t SetToBitset (const std::set< INT > &indices)
 Converts of set of indices into a bitset with those bits set.
int FindSetBit (const bitset_t &b)
 Returns the bit that is set in b.
int FirstSetBit (const bitset_t &b)
 Returns least-significant set bit in b.

Detailed Description

Utilities on bitsets.


Function Documentation

void BitsetUtil::BitsetToBytes ( const bitset_t b,
byte out,
int  numbits 
)

Converts the bottom numbits of b into a byte stream.

std::string BitsetUtil::BitsetToHex ( const bitset_t b,
int  numbits 
)

Converts a bitset into a string of hex symbols.

template<typename INT >
void BitsetUtil::BitsetToVector ( const bitset_t b,
std::vector< INT > &  indices 
) [inline]

Stores indices of set bits in b in indices.

Note:
INT must be convertible to an int.

Definition at line 131 of file Bitset.hpp.

References BITSETSIZE, benzene_bitset< _Nb >::count(), and benzene_bitset< _Nb >::test().

Referenced by HexUctPolicy::InitializeForRollout(), ProofUtil::StoreTranspositions(), and VCUtils::ValidEdgeBridge().

bitset_t BitsetUtil::BytesToBitset ( const byte bytes,
int  numbits 
)

Converts a byte stream into a bitset.

Definition at line 27 of file Bitset.cpp.

References benzene_bitset< _Nb >::set().

int BitsetUtil::FindSetBit ( const bitset_t b  ) 

Returns the bit that is set in b.

Referenced by BenzenePlayer::CheckEndgame().

int BitsetUtil::FirstSetBit ( const bitset_t b  ) 

Returns least-significant set bit in b.

Referenced by BoardUtils::FindSplittingDecomposition().

bitset_t BitsetUtil::HexToBitset ( const std::string &  str  ) 

Converts a string of hex symbols into a bitset.

Definition at line 58 of file Bitset.cpp.

References benzene_bitset< _Nb >::set().

bool BitsetUtil::IsLessThan ( const bitset_t b1,
const bitset_t b2 
) [inline]

Returns true if b1 comes before b2 in some consistent order (any well defined ordering, not necessarily lexicographic).

Definition at line 167 of file Bitset.hpp.

References BITSETSIZE, and benzene_bitset< _Nb >::is_less_than().

Referenced by VC::operator<().

bool BitsetUtil::IsSubsetOf ( const bitset_t b1,
const bitset_t b2 
) [inline]
template<typename INT >
bitset_t BitsetUtil::SetToBitset ( const std::set< INT > &  indices  )  [inline]

Converts of set of indices into a bitset with those bits set.

Note:
INT must be convertible to an int.

Definition at line 143 of file Bitset.hpp.

References benzene_bitset< _Nb >::set().

Referenced by InferiorCells::AddDominatedFrom(), InferiorCells::Dominated(), and InferiorCells::RemoveDominated().

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.

Otherwise, removeFrom is not changed and returns false.


6 Jan 2011 Doxygen 1.6.3