Function DoFindPrev
Synopsis
#include <include/EASTL/bitset.h>
size_type DoFindPrev(size_type last_find) const
Description
No description yet.
Source
Lines 1681-1717 in include/EASTL/bitset.h. Line 278 in include/EASTL/bitset.h.
template <typename WordType>
inline typename BitsetBase<2, WordType>::size_type
BitsetBase<2, WordType>::DoFindPrev(size_type last_find) const
{
// If the last find was in the second word, we must check it and then possibly the first.
if(last_find > (size_type)kBitsPerWord)
{
// This has the same effect as last_find %= kBitsPerWord in our case.
last_find -= kBitsPerWord;
// Mask off previous bits of word so our search becomes a "find first".
word_type this_word = mWord[1] & ((~static_cast<word_type>(0)) >> (kBitsPerWord - last_find));
// Step through words.
size_type lbiw = GetLastBit(this_word);
if(lbiw != kBitsPerWord)
return kBitsPerWord + lbiw;
lbiw = GetLastBit(mWord[0]);
if(lbiw != kBitsPerWord)
return lbiw;
}
else if(last_find != 0)
{
// Mask off previous bits of word so our search becomes a "find first".
word_type this_word = mWord[0] & ((~static_cast<word_type>(0)) >> (kBitsPerWord - last_find));
const size_type lbiw = GetLastBit(this_word);
if(lbiw != kBitsPerWord)
return lbiw;
}
return 2 * kBitsPerWord;
}