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 574 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 594 of file SparseBitVector.h.

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

◆ AdvanceToNextNonZero()

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

Definition at line 613 of file SparseBitVector.h.

614 {
615 if (AtEnd)
616 return;
617
618 while (Bits && !(Bits & 1))
619 {
620 Bits >>= 1;
621 BitNumber += 1;
622 }
623
624 // See if we ran out of Bits in this word.
625 if (!Bits)
626 {
628 // If we ran out of set bits in this element, move to next element.
629 if (NextSetBitNumber == -1 || (BitNumber % ElementSize == 0))
630 {
631 ++Iter;
632 WordNumber = 0;
633
634 // We may run out of elements in the bitmap.
635 if (Iter == BitVector->Elements.end())
636 {
637 AtEnd = true;
638 return;
639 }
640 // Set up for next non-zero word in bitmap.
641 BitNumber = Iter->index() * ElementSize;
642 NextSetBitNumber = Iter->find_first();
647 }
648 else
649 {
655 }
656 }
657 }
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 706 of file SparseBitVector.h.

707 {
708 return !(*this == RHS);
709 }

◆ operator*()

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

Definition at line 691 of file SparseBitVector.h.

692 {
693 return BitNumber;
694 }

◆ operator++() [1/2]

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

Definition at line 674 of file SparseBitVector.h.

675 {
676 ++BitNumber;
677 Bits >>= 1;
679 return *this;
680 }

◆ operator++() [2/2]

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

Definition at line 683 of file SparseBitVector.h.

684 {
686 ++*this;
687 return tmp;
688 }

◆ operator==()

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

Definition at line 696 of file SparseBitVector.h.

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

Member Data Documentation

◆ AtEnd

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

Definition at line 577 of file SparseBitVector.h.

◆ BitNumber

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

Definition at line 585 of file SparseBitVector.h.

◆ Bits

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

Definition at line 591 of file SparseBitVector.h.

◆ BitVector

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

Definition at line 579 of file SparseBitVector.h.

◆ Iter

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

Definition at line 582 of file SparseBitVector.h.

◆ WordNumber

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

Definition at line 588 of file SparseBitVector.h.


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