Struct BitsetBase< 1, WordType >

Synopsis

#include <include/EASTL/bitset.h>

template <typename WordType>
struct BitsetBase<1, WordType>

Description

BitsetBase<1, WordType>

This is a specialization for a bitset that fits within one word.

Methods

any
BitsetBase overloadBitsetBase<1, WordType>
count
DoFindFirst
DoFindLast
DoFindNext
DoFindPrev
DoGetWord overload
flip
from_uint32
from_uint64
operator&=template <typename WordType> inline BitsetBase<1, WordType>::BitsetBase(uint64_t value) { #if(EA_PLATFORM_WORD_SIZE == 4) EASTL_ASSERT(value <= 0xffffffff); mWord[0] = static_cast<word_type>(value); // This potentially loses data, but that's what the user is requesting
operator<<=
operator==
operator>>=
operator^=
operator|=
reset
set overload
to_uint32
to_uint64
to_ulong

Source

Lines 155-213 in include/EASTL/bitset.h.

template <typename WordType>
struct BitsetBase<1, WordType>
{
    typedef WordType                word_type;
    typedef BitsetBase<1, 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[1]; // Defined as an array of 1 so that bitset can treat this BitsetBase like others.
public:
    BitsetBase();
    BitsetBase(uint32_t value);
  //BitsetBase(uint64_t value); // Disabled because it causes conflicts with the 32 bit version with existing user code. Use from_uint64 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);
    word_type  DoGetWord(size_type) const;
    size_type DoFindFirst() const;
    size_type DoFindNext(size_type last_find) const;
    size_type DoFindLast() const;                       // Returns 1 * kBitsPerWord (the bit count) if no bits are set.
    size_type DoFindPrev(size_type last_find) const;    // Returns 1 * kBitsPerWord (the bit count) if no bits are set.
}; // BitsetBase<1, WordType>





Add Discussion as Guest

Log in