Struct BitsetBase

Synopsis

#include <include/EASTL/bitset.h>

template <size_t NW, typename WordType> // Templated on the number of words used to hold the bitset and the word type.
struct BitsetBase

Description

BitsetBase

This is a default implementation that works for any number of words.

Methods

BitsetBase overloadBitsetBase
any
count
DoFindFirst
DoFindLast
DoFindNext
DoFindPrev
DoGetWord overload
flip
from_uint32
from_uint64
operator&=
operator<<=
operator==
operator>>=
operator^=
operator|=
reset
set overload
to_uint32
to_uint64
to_ulong

Source

Lines 89-147 in include/EASTL/bitset.h.

template <size_t NW, typename WordType> // Templated on the number of words used to hold the bitset and the word type.
struct BitsetBase
{
    typedef WordType                 word_type;
    typedef BitsetBase<NW, WordType> this_type;
  #if EASTL_BITSET_SIZE_T
    typedef size_t                   size_type;
  #else
    typedef eastl_size_t             size_type;
  #endif
    enum {
        kBitsPerWord      = (8 * sizeof(word_type)),
        kBitsPerWordMask  = (kBitsPerWord - 1),
        kBitsPerWordShift = ((kBitsPerWord == 8) ? 3 : ((kBitsPerWord == 16) ? 4 : ((kBitsPerWord == 32) ? 5 : (((kBitsPerWord == 64) ? 6 : 7)))))
    };
public:
    word_type mWord[NW];
public:
    BitsetBase();
    BitsetBase(uint32_t value); // This exists only for compatibility with std::bitset, which has a 'long' constructor.
  //BitsetBase(uint64_t value); // Disabled because it causes conflicts with the 32 bit version with existing user code. Use from_uint64 to init from a uint64_t instead.
    void operator&=(const this_type& x);
    void operator|=(const this_type& x);
    void operator^=(const this_type& x);
    void operator<<=(size_type n);
    void operator>>=(size_type n);
    void flip();
    void set();
    void set(size_type i, bool value);
    void reset();
    bool operator==(const this_type& x) const;
    bool      any() const;
    size_type count() const;
    void          from_uint32(uint32_t value);
    void          from_uint64(uint64_t value);
    unsigned long to_ulong() const;
    uint32_t      to_uint32() const;
    uint64_t      to_uint64() const;
    word_type& DoGetWord(size_type i);
    word_type  DoGetWord(size_type i) const;
    size_type DoFindFirst() const;
    size_type DoFindNext(size_type last_find) const;
    size_type DoFindLast() const;                       // Returns NW * kBitsPerWord (the bit count) if no bits are set.
    size_type DoFindPrev(size_type last_find) const;    // Returns NW * kBitsPerWord (the bit count) if no bits are set.
}; // class BitsetBase





Add Discussion as Guest

Log in