![]() |
TSDuck v3.46-4965
MPEG Transport Stream Toolkit
|
#include <tsCompactBitSet.h>
Public Types | |
| using | int_t = typename smaller_unsigned<BITS>::type |
Public Member Functions | |
| template<class CONTAINER> requires std::integral<typename CONTAINER::value_type> | |
| CompactBitSet (const CONTAINER &values) | |
| CompactBitSet (int_t value=0) | |
| bool | all () const |
| bool | any () const |
| void | flip () |
| bool | none () const |
| CompactBitSet< BITS > | operator& (const CompactBitSet< BITS > &p) const |
| CompactBitSet< BITS > & | operator&= (const CompactBitSet< BITS > &p) |
| bool | operator== (const CompactBitSet< BITS > &p) const |
| CompactBitSet< BITS > | operator| (const CompactBitSet< BITS > &p) const |
| CompactBitSet< BITS > & | operator|= (const CompactBitSet< BITS > &p) |
| CompactBitSet< BITS > | operator~ () const |
| void | reset () |
| void | reset (size_t pos) |
| void | set () |
| void | set (size_t pos, bool value=true) |
| size_t | size () const |
| bool | test (size_t pos) const |
| int_t | toInt () const |
Static Public Attributes | |
| static constexpr int_t | ALL = int_t(BITS == 8 * sizeof(int_t) ? ~int_t(0) : ~(~uint64_t(0) << BITS)) |
| static constexpr size_t | MAX = BITS - 1 |
| static constexpr size_t | SIZE = BITS |
A compact version of std::bitset.
This class is more efficient than std::bitset for small sizes, typically 32 bits or less.
Differences with std::bitset:
| BITS | Number of bits. Must be in the range 0 to 64. |
| using ts::CompactBitSet< BITS >::int_t = typename smaller_unsigned<BITS>::type |
The underlying unsigned integer type to represent the bit set.
|
inline |
Constructor.
| [in] | value | Initial value as a bit mask. Bits are numbered from LSB to MSB. |
|
inline |
Constructor from a container of integer values.
| CONTAINER | A container type of integer values. |
| [in] | values | Initial bit values to set. Bits are numbered from LSB to MSB. |
|
inline |
Equality operator.
| [in] | p | Other instance to compare. |
|
inline |
Get the size in bits of the bit set.
|
inline |
Negation unary operator.
|
inline |
Binary or operator.
| [in] | p | Other instance to compare. |
|
inline |
Binary and operator.
| [in] | p | Other instance to compare. |
|
inline |
Assign with binary or operator.
| [in] | p | Other instance to compare. |
|
inline |
Assign with binary and operator.
| [in] | p | Other instance to compare. |
|
inline |
Check if all bits are set.
|
inline |
Check if at least one bit is set.
|
inline |
Check if no bit is set.
|
inline |
Flip all bits in the set.
|
inline |
Set all bits.
|
inline |
Set or reset one bit.
| [in] | pos | Bit to alter, 0 to 31. |
| [in] | value | Optional bit value to set, true by default. |
|
inline |
Reset all bits.
|
inline |
Reset one bit.
| [in] | pos | Bit to reset, 0 to 31. |
|
inline |
Test is a bit is set.
| [in] | pos | bit to test, 0 to 31. |
|
inline |
Return the set of bits as a 32-bit integer.
|
staticconstexpr |
Number of bits in this set.
|
staticconstexpr |
Maximum value for bit position.
|
staticconstexpr |
The int_t value corresponding to all bits set.