Function flip

Summary

#include <include/EASTL/bitset.h>

(1) this_type & flip()

(2) this_type & flip(size_type i)

Function overload

Synopsis

#include <include/EASTL/bitset.h>

this_type & flip()

Description

No description yet.

Source

Lines 1937-1947 in include/EASTL/bitset.h. Line 387 in include/EASTL/bitset.h.

template <size_t N, typename WordType>
inline typename bitset<N, WordType>::this_type&
bitset<N, WordType>::flip()
{
    EA_DISABLE_VC_WARNING(6313)
    base_type::flip();
    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;
    EA_RESTORE_VC_WARNING()
}

Synopsis

#include <include/EASTL/bitset.h>

this_type & flip(size_type i)

Description

No description yet.

Source

Lines 1950-1968 in include/EASTL/bitset.h. Line 388 in include/EASTL/bitset.h.

template <size_t N, typename WordType>
inline typename bitset<N, WordType>::this_type&
bitset<N, WordType>::flip(size_type i)
{
    if(EASTL_LIKELY(i < N))
        DoGetWord(i) ^= (static_cast<word_type>(1) << (i & kBitsPerWordMask));
    else
    {
        #if EASTL_ASSERT_ENABLED
            if(EASTL_UNLIKELY(!(i < N)))
                EASTL_FAIL_MSG("bitset::flip -- out of range");
        #endif
        #if EASTL_EXCEPTIONS_ENABLED
            throw std::out_of_range("bitset::flip");
        #endif
    }
    return *this;
}





Add Discussion as Guest

Log in