Turi Create  4.0
turi::fixed_dense_bitset< len > Class Template Reference

#include <core/util/dense_bitset.hpp>

Public Member Functions

 fixed_dense_bitset ()
 Constructs a bitset of 0 length.
 
 fixed_dense_bitset (const fixed_dense_bitset< len > &db)
 Make a copy of the bitset db.
 
void initialize_from_mem (void *mem, size_t memlen)
 
 ~fixed_dense_bitset ()
 destructor
 
fixed_dense_bitset< len > & operator= (const fixed_dense_bitset< len > &db)
 Make a copy of the bitset db.
 
void clear ()
 Sets all bits to 0.
 
void fill ()
 Sets all bits to 1.
 
void prefetch (size_t b) const
 Prefetches the word containing the bit b.
 
bool get (size_t b) const
 Returns the value of the bit b.
 
bool set_bit (size_t b)
 Atomically sets the bit at b to true returning the old value.
 
size_t containing_word (size_t b)
 Returns the value of the word containing the bit b.
 
bool set_bit_unsync (size_t b)
 
bool set (size_t b, bool value)
 
bool set_unsync (size_t b, bool value)
 
bool clear_bit (size_t b)
 Atomically set the bit at b to false returning the old value.
 
bool clear_bit_unsync (size_t b)
 
bool first_bit (size_t &b) const
 
bool first_zero_bit (size_t &b) const
 
bool next_bit (size_t &b) const
 
size_t size () const
 Returns the number of bits in this bitset.
 
void save (oarchive &oarc) const
 Serializes this bitset to an archive.
 
void load (iarchive &iarc)
 Deserializes this bitset from an archive.
 

Detailed Description

template<int len>
class turi::fixed_dense_bitset< len >

Like bitset, but of a fixed length as defined by the template parameter

Definition at line 547 of file dense_bitset.hpp.

Member Function Documentation

◆ clear_bit_unsync()

template<int len>
bool turi::fixed_dense_bitset< len >::clear_bit_unsync ( size_t  b)
inline

Clears the state of the bit returning the old value. This version uses a non-atomic set which is faster, but is unsafe if accessed by multiple threads.

Definition at line 673 of file dense_bitset.hpp.

◆ first_bit()

template<int len>
bool turi::fixed_dense_bitset< len >::first_bit ( size_t &  b) const
inline

Returns true with b containing the position of the first bit set to true. If such a bit does not exist, this function returns false.

Definition at line 736 of file dense_bitset.hpp.

◆ first_zero_bit()

template<int len>
bool turi::fixed_dense_bitset< len >::first_zero_bit ( size_t &  b) const
inline

Returns true with b containing the position of the first bit set to false. If such a bit does not exist, this function returns false.

Definition at line 750 of file dense_bitset.hpp.

◆ initialize_from_mem()

template<int len>
void turi::fixed_dense_bitset< len >::initialize_from_mem ( void *  mem,
size_t  memlen 
)
inline

Initialize this fixed dense bitset by copying ceil(len/(wordlen)) words from mem

Definition at line 562 of file dense_bitset.hpp.

◆ next_bit()

template<int len>
bool turi::fixed_dense_bitset< len >::next_bit ( size_t &  b) const
inline

Where b is a bit index, this function will return in b, the position of the next bit set to true, and return true. If all bits after b are false, this function returns false.

Definition at line 766 of file dense_bitset.hpp.

◆ set()

template<int len>
bool turi::fixed_dense_bitset< len >::set ( size_t  b,
bool  value 
)
inline

Set the state of the bit returning the old value. This version uses a non-atomic set which is faster, but is unsafe if accessed by multiple threads.

Definition at line 639 of file dense_bitset.hpp.

◆ set_bit_unsync()

template<int len>
bool turi::fixed_dense_bitset< len >::set_bit_unsync ( size_t  b)
inline

Set the bit at position b to true returning the old value. Unlike set_bit(), this uses a non-atomic set which is faster, but is unsafe if accessed by multiple threads.

Definition at line 625 of file dense_bitset.hpp.

◆ set_unsync()

template<int len>
bool turi::fixed_dense_bitset< len >::set_unsync ( size_t  b,
bool  value 
)
inline

Set the state of the bit returning the old value. This version uses a non-atomic set which is faster, but is unsafe if accessed by multiple threads.

Definition at line 648 of file dense_bitset.hpp.


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