spot 2.16
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | List of all members
spot::bitset< N > Class Template Reference

A fixed-size bitset backed by N unsigned words. More...

#include <spot/misc/bitset.hh>

Inheritance diagram for spot::bitset< N >:
Collaboration diagram for spot::bitset< N >:

Public Member Functions

 operator bool () const
 Return true if any bit is set.
 
size_t hash () const
 Return a hash of the bitset.
 
bool operator== (const bitset &other) const
 Equality comparison.
 
bool operator!= (const bitset &other) const
 Inequality comparison.
 
bool operator< (const bitset &other) const
 Lexicographic less-than comparison.
 
bool operator<= (const bitset &other) const
 Lexicographic less-than-or-equal comparison.
 
bool operator> (const bitset &other) const
 Lexicographic greater-than comparison.
 
bool operator>= (const bitset &other) const
 Lexicographic greater-than-or-equal comparison.
 
void set (unsigned s)
 Set bit s to one.
 
void clear (unsigned s)
 Clear bit s (set it to zero).
 
bitset operator<< (unsigned s) const
 Return the bitset shifted left by s positions.
 
bitset operator>> (unsigned s) const
 Return the bitset shifted right by s positions.
 
bitsetoperator<<= (unsigned s)
 Shift left in place by s positions.
 
bitsetoperator>>= (unsigned s)
 Shift right in place by s positions.
 
bitset operator~ () const
 Return the bitwise complement.
 
bitset operator& (const bitset &other) const
 Return the bitwise AND of *this and other.
 
bitset operator| (const bitset &other) const
 Return the bitwise OR of *this and other.
 
bitset operator^ (const bitset &other) const
 Return the bitwise XOR of *this and other.
 
bitsetoperator&= (const bitset &other)
 In-place bitwise AND with other.
 
bitsetoperator|= (const bitset &other)
 In-place bitwise OR with other.
 
bitsetoperator^= (const bitset &other)
 In-place bitwise XOR with other.
 
bitset operator- (word_t s) const
 Return the result of subtracting s from the bitset.
 
bitsetoperator-= (word_t s)
 Subtract s from the bitset in place.
 
bitset operator- () const
 Return the arithmetic negation (two's complement).
 
unsigned count () const
 Return the number of set bits (popcount).
 
unsigned highest () const
 Return the position of the highest set bit.
 
unsigned lowest () const
 Return the position of the lowest set bit.
 

Static Public Member Functions

static constexpr bitset zero ()
 the 0
 
static constexpr bitset one ()
 the 1
 
static bitset mone ()
 the -1 (all bits are set to 1)
 

Detailed Description

template<size_t N>
class spot::bitset< N >

A fixed-size bitset backed by N unsigned words.

Member Function Documentation

◆ clear()

template<size_t N>
void spot::bitset< N >::clear ( unsigned  s)
inline

Clear bit s (set it to zero).

◆ count()

template<size_t N>
unsigned spot::bitset< N >::count ( ) const
inline

Return the number of set bits (popcount).

References spot::U.

◆ hash()

template<size_t N>
size_t spot::bitset< N >::hash ( ) const
inline

Return a hash of the bitset.

References spot::fnv_hash().

Referenced by std::hash< spot::bitset< N > >::operator()().

◆ highest()

template<size_t N>
unsigned spot::bitset< N >::highest ( ) const
inline

Return the position of the highest set bit.

References spot::clz().

◆ lowest()

template<size_t N>
unsigned spot::bitset< N >::lowest ( ) const
inline

Return the position of the lowest set bit.

References spot::U.

◆ mone()

template<size_t N>
static bitset spot::bitset< N >::mone ( )
inlinestatic

the -1 (all bits are set to 1)

◆ one()

template<size_t N>
static constexpr bitset spot::bitset< N >::one ( )
inlinestaticconstexpr

the 1

◆ operator bool()

template<size_t N>
spot::bitset< N >::operator bool ( ) const
inlineexplicit

Return true if any bit is set.

◆ operator!=()

template<size_t N>
bool spot::bitset< N >::operator!= ( const bitset< N > &  other) const
inline

Inequality comparison.

References spot::operator==().

◆ operator&()

template<size_t N>
bitset spot::bitset< N >::operator& ( const bitset< N > &  other) const
inline

Return the bitwise AND of *this and other.

◆ operator&=()

template<size_t N>
bitset & spot::bitset< N >::operator&= ( const bitset< N > &  other)
inline

In-place bitwise AND with other.

◆ operator-() [1/2]

template<size_t N>
bitset spot::bitset< N >::operator- ( ) const
inline

Return the arithmetic negation (two's complement).

◆ operator-() [2/2]

template<size_t N>
bitset spot::bitset< N >::operator- ( word_t  s) const
inline

Return the result of subtracting s from the bitset.

◆ operator-=()

template<size_t N>
bitset & spot::bitset< N >::operator-= ( word_t  s)
inline

Subtract s from the bitset in place.

◆ operator<()

template<size_t N>
bool spot::bitset< N >::operator< ( const bitset< N > &  other) const
inline

Lexicographic less-than comparison.

◆ operator<<()

template<size_t N>
bitset spot::bitset< N >::operator<< ( unsigned  s) const
inline

Return the bitset shifted left by s positions.

◆ operator<<=()

template<size_t N>
bitset & spot::bitset< N >::operator<<= ( unsigned  s)
inline

Shift left in place by s positions.

◆ operator<=()

template<size_t N>
bool spot::bitset< N >::operator<= ( const bitset< N > &  other) const
inline

Lexicographic less-than-or-equal comparison.

◆ operator==()

template<size_t N>
bool spot::bitset< N >::operator== ( const bitset< N > &  other) const
inline

Equality comparison.

◆ operator>()

template<size_t N>
bool spot::bitset< N >::operator> ( const bitset< N > &  other) const
inline

Lexicographic greater-than comparison.

◆ operator>=()

template<size_t N>
bool spot::bitset< N >::operator>= ( const bitset< N > &  other) const
inline

Lexicographic greater-than-or-equal comparison.

◆ operator>>()

template<size_t N>
bitset spot::bitset< N >::operator>> ( unsigned  s) const
inline

Return the bitset shifted right by s positions.

◆ operator>>=()

template<size_t N>
bitset & spot::bitset< N >::operator>>= ( unsigned  s)
inline

Shift right in place by s positions.

◆ operator^()

template<size_t N>
bitset spot::bitset< N >::operator^ ( const bitset< N > &  other) const
inline

Return the bitwise XOR of *this and other.

◆ operator^=()

template<size_t N>
bitset & spot::bitset< N >::operator^= ( const bitset< N > &  other)
inline

In-place bitwise XOR with other.

◆ operator|()

template<size_t N>
bitset spot::bitset< N >::operator| ( const bitset< N > &  other) const
inline

Return the bitwise OR of *this and other.

◆ operator|=()

template<size_t N>
bitset & spot::bitset< N >::operator|= ( const bitset< N > &  other)
inline

In-place bitwise OR with other.

◆ operator~()

template<size_t N>
bitset spot::bitset< N >::operator~ ( ) const
inline

Return the bitwise complement.

◆ set()

template<size_t N>
void spot::bitset< N >::set ( unsigned  s)
inline

Set bit s to one.

◆ zero()

template<size_t N>
static constexpr bitset spot::bitset< N >::zero ( )
inlinestaticconstexpr

the 0

References spot::U.


The documentation for this class was generated from the following file:

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.
Generated on Fri Feb 27 2015 10:00:07 for spot by doxygen 1.9.8