Function count

Synopsis

#include <include/EASTL/bitset.h>

size_type count() const

Description

No description yet.

Source

Lines 1211-1229 in include/EASTL/bitset.h. Line 195 in include/EASTL/bitset.h.

template <typename WordType>
inline typename BitsetBase<1, WordType>::size_type
BitsetBase<1, WordType>::count() const
{
    #if defined(__GNUC__) && (((__GNUC__ * 100) + __GNUC_MINOR__) >= 304) && !defined(EA_PLATFORM_ANDROID) // GCC 3.4 or later
        #if(EA_PLATFORM_WORD_SIZE == 4)
            return (size_type)__builtin_popcountl(mWord[0]);
        #else
            return (size_type)__builtin_popcountll(mWord[0]);
        #endif
    #elif defined(__GNUC__) && (__GNUC__ < 3)
        return BitsetCountBits(mWord[0]); // GCC 2.x compiler inexplicably blows up on the code below.
    #else
        size_type n = 0;
        for(word_type w = mWord[0]; w; w >>= 4)
            n += EASTL_BITSET_COUNT_STRING[w & 0xF];
        return n;
    #endif
}





Add Discussion as Guest

Log in