Function set

Summary

#include <include/EASTL/bitset.h>

(1) this_type & set()

(2) this_type & set(size_type i, bool value=true)

Function overload

Synopsis

#include <include/EASTL/bitset.h>

this_type & set()

Description

No description yet.

Source

Lines 1873-1881 in include/EASTL/bitset.h. Line 381 in include/EASTL/bitset.h.

template <size_t N, typename WordType>
inline typename bitset<N, WordType>::this_type&
bitset<N, WordType>::set()
{
    base_type::set(); // This sets all bits.
    if((N & kBitsPerWordMask) || (N == 0)) // If there are any high bits to clear... (If we didn't have this check, then the code below would do the wrong thing when N == 32.
        mWord[kWordCount - 1] &= ~(static_cast<word_type>(~static_cast<word_type>(0)) << (N & kBitsPerWordMask)); // This clears any high unused bits. We need to do this so that shift operations proceed correctly.
    return *this;
}

Synopsis

#include <include/EASTL/bitset.h>

this_type & set(size_type i, bool value=true)

Description

No description yet.

Source

Lines 1884-1903 in include/EASTL/bitset.h. Line 382 in include/EASTL/bitset.h.

template <size_t N, typename WordType>
inline typename bitset<N, WordType>::this_type&
bitset<N, WordType>::set(size_type i, bool value)
{
    if(i < N)
        base_type::set(i, value);
    else
    {
        #if EASTL_ASSERT_ENABLED
            if(EASTL_UNLIKELY(!(i < N)))
                EASTL_FAIL_MSG("bitset::set -- out of range");
        #endif
        #if EASTL_EXCEPTIONS_ENABLED
            throw std::out_of_range("bitset::set");
        #endif
    }
    return *this;
}





Add Discussion as Guest

Log in