Static Value-Flow Analysis
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
SVF::SparseBitVector< ElementSize >::SparseBitVectorIterator Class Reference

Public Member Functions

 SparseBitVectorIterator ()=delete
 
 SparseBitVectorIterator (const SparseBitVector< ElementSize > *RHS, bool end=false)
 
SparseBitVectorIteratoroperator++ ()
 
SparseBitVectorIterator operator++ (int)
 
unsigned operator* () const
 
bool operator== (const SparseBitVectorIterator &RHS) const
 
bool operator!= (const SparseBitVectorIterator &RHS) const
 

Private Member Functions

void AdvanceToFirstNonZero ()
 
void AdvanceToNextNonZero ()
 

Private Attributes

bool AtEnd
 
const SparseBitVector< ElementSize > * BitVector = nullptr
 
ElementListConstIter Iter
 
unsigned BitNumber
 
unsigned WordNumber
 
SparseBitVectorElement< ElementSize >::BitWord Bits
 

Detailed Description

template<unsigned ElementSize = 128>
class SVF::SparseBitVector< ElementSize >::SparseBitVectorIterator

Definition at line 578 of file SparseBitVector.h.

Constructor & Destructor Documentation

◆ SparseBitVectorIterator() [1/2]

template<unsigned ElementSize = 128>
SVF::SparseBitVector< ElementSize >::SparseBitVectorIterator::SparseBitVectorIterator ( )
delete

◆ SparseBitVectorIterator() [2/2]

template<unsigned ElementSize = 128>
SVF::SparseBitVector< ElementSize >::SparseBitVectorIterator::SparseBitVectorIterator ( const SparseBitVector< ElementSize > *  RHS,
bool  end = false 
)
inline

Member Function Documentation

◆ AdvanceToFirstNonZero()

template<unsigned ElementSize = 128>
void SVF::SparseBitVector< ElementSize >::SparseBitVectorIterator::AdvanceToFirstNonZero ( )
inlineprivate

Definition at line 598 of file SparseBitVector.h.

599 {
600 if (AtEnd)
601 return;
602 if (BitVector->Elements.empty())
603 {
604 AtEnd = true;
605 return;
606 }
607 Iter = BitVector->Elements.begin();
608 BitNumber = Iter->index() * ElementSize;
609 unsigned BitPos = Iter->find_first();
610 BitNumber += BitPos;
614 }
BitWord word(unsigned Idx) const

◆ AdvanceToNextNonZero()

template<unsigned ElementSize = 128>
void SVF::SparseBitVector< ElementSize >::SparseBitVectorIterator::AdvanceToNextNonZero ( )
inlineprivate

Definition at line 617 of file SparseBitVector.h.

618 {
619 if (AtEnd)
620 return;
621
622 while (Bits && !(Bits & 1))
623 {
624 Bits >>= 1;
625 BitNumber += 1;
626 }
627
628 // See if we ran out of Bits in this word.
629 if (!Bits)
630 {
632 // If we ran out of set bits in this element, move to next element.
633 if (NextSetBitNumber == -1 || (BitNumber % ElementSize == 0))
634 {
635 ++Iter;
636 WordNumber = 0;
637
638 // We may run out of elements in the bitmap.
639 if (Iter == BitVector->Elements.end())
640 {
641 AtEnd = true;
642 return;
643 }
644 // Set up for next non-zero word in bitmap.
645 BitNumber = Iter->index() * ElementSize;
646 NextSetBitNumber = Iter->find_first();
651 }
652 else
653 {
659 }
660 }
661 }
int find_next(unsigned Curr) const

◆ operator!=()

template<unsigned ElementSize = 128>
bool SVF::SparseBitVector< ElementSize >::SparseBitVectorIterator::operator!= ( const SparseBitVectorIterator RHS) const
inline

Definition at line 710 of file SparseBitVector.h.

711 {
712 return !(*this == RHS);
713 }

◆ operator*()

template<unsigned ElementSize = 128>
unsigned SVF::SparseBitVector< ElementSize >::SparseBitVectorIterator::operator* ( ) const
inline

Definition at line 695 of file SparseBitVector.h.

696 {
697 return BitNumber;
698 }

◆ operator++() [1/2]

template<unsigned ElementSize = 128>
SparseBitVectorIterator & SVF::SparseBitVector< ElementSize >::SparseBitVectorIterator::operator++ ( )
inline

Definition at line 678 of file SparseBitVector.h.

679 {
680 ++BitNumber;
681 Bits >>= 1;
683 return *this;
684 }

◆ operator++() [2/2]

template<unsigned ElementSize = 128>
SparseBitVectorIterator SVF::SparseBitVector< ElementSize >::SparseBitVectorIterator::operator++ ( int  )
inline

Definition at line 687 of file SparseBitVector.h.

688 {
690 ++*this;
691 return tmp;
692 }

◆ operator==()

template<unsigned ElementSize = 128>
bool SVF::SparseBitVector< ElementSize >::SparseBitVectorIterator::operator== ( const SparseBitVectorIterator RHS) const
inline

Definition at line 700 of file SparseBitVector.h.

701 {
702 // If they are both at the end, ignore the rest of the fields.
703 if (AtEnd && RHS.AtEnd)
704 return true;
705 // Otherwise they are the same if they have the same bit number and
706 // bitmap.
707 return AtEnd == RHS.AtEnd && RHS.BitNumber == BitNumber;
708 }

Member Data Documentation

◆ AtEnd

template<unsigned ElementSize = 128>
bool SVF::SparseBitVector< ElementSize >::SparseBitVectorIterator::AtEnd
private

Definition at line 581 of file SparseBitVector.h.

◆ BitNumber

template<unsigned ElementSize = 128>
unsigned SVF::SparseBitVector< ElementSize >::SparseBitVectorIterator::BitNumber
private

Definition at line 589 of file SparseBitVector.h.

◆ Bits

template<unsigned ElementSize = 128>
SparseBitVectorElement<ElementSize>::BitWord SVF::SparseBitVector< ElementSize >::SparseBitVectorIterator::Bits
private

Definition at line 595 of file SparseBitVector.h.

◆ BitVector

template<unsigned ElementSize = 128>
const SparseBitVector<ElementSize>* SVF::SparseBitVector< ElementSize >::SparseBitVectorIterator::BitVector = nullptr
private

Definition at line 583 of file SparseBitVector.h.

◆ Iter

template<unsigned ElementSize = 128>
ElementListConstIter SVF::SparseBitVector< ElementSize >::SparseBitVectorIterator::Iter
private

Definition at line 586 of file SparseBitVector.h.

◆ WordNumber

template<unsigned ElementSize = 128>
unsigned SVF::SparseBitVector< ElementSize >::SparseBitVectorIterator::WordNumber
private

Definition at line 592 of file SparseBitVector.h.


The documentation for this class was generated from the following file: