Static Value-Flow Analysis
Public Member Functions | List of all members
SVF::BitVector Class Reference

#include <BitVector.h>

Inheritance diagram for SVF::BitVector:
SVF::CoreBitVector

Public Member Functions

 BitVector (void)
 Construct empty BV. More...
 
 BitVector (size_t n)
 Construct empty BV with space reserved for n Words. More...
 
 BitVector (const BitVector &bv)
 Copy constructor. More...
 
 BitVector (BitVector &&bv)
 Move constructor. More...
 
BitVectoroperator= (const BitVector &rhs)
 Copy assignment. More...
 
BitVectoroperator= (BitVector &&rhs)
 Move assignment. More...
 
- Public Member Functions inherited from SVF::CoreBitVector
 CoreBitVector (void)
 Construct empty CBV. More...
 
 CoreBitVector (size_t n)
 Construct empty CBV with space reserved for n Words. More...
 
 CoreBitVector (const CoreBitVector &cbv)
 Copy constructor. More...
 
 CoreBitVector (CoreBitVector &&cbv)
 Move constructor. More...
 
CoreBitVectoroperator= (const CoreBitVector &rhs)
 Copy assignment. More...
 
CoreBitVectoroperator= (CoreBitVector &&rhs)
 Move assignment. More...
 
bool empty (void) const
 Returns true if no bits are set. More...
 
u32_t count (void) const
 Returns number of bits set. More...
 
void clear (void)
 Empty the CBV. More...
 
bool test (u32_t bit) const
 Returns true if bit is set in this CBV. More...
 
bool test_and_set (u32_t bit)
 
void set (u32_t bit)
 Sets bit in the CBV. More...
 
void reset (u32_t bit)
 Resets bit in the CBV. More...
 
bool contains (const CoreBitVector &rhs) const
 Returns true if this CBV is a superset of rhs. More...
 
bool intersects (const CoreBitVector &rhs) const
 Returns true if this CBV and rhs share any set bits. More...
 
bool operator== (const CoreBitVector &rhs) const
 Returns true if this CBV and rhs have the same bits set. More...
 
bool operator!= (const CoreBitVector &rhs) const
 Returns true if either this CBV or rhs has a bit set unique to the other. More...
 
bool operator|= (const CoreBitVector &rhs)
 
bool operator&= (const CoreBitVector &rhs)
 
bool operator-= (const CoreBitVector &rhs)
 
bool intersectWithComplement (const CoreBitVector &rhs)
 
void intersectWithComplement (const CoreBitVector &lhs, const CoreBitVector &rhs)
 Put intersection of lhs with complement of rhs into this CBV. More...
 
size_t hash (void) const
 Hash for this CBV. More...
 
const_iterator begin (void) const
 
const_iterator end (void) const
 

Additional Inherited Members

- Public Types inherited from SVF::CoreBitVector
typedef unsigned long long Word
 
typedef CoreBitVectorIterator const_iterator
 
typedef const_iterator iterator
 
- Static Public Attributes inherited from SVF::CoreBitVector
static const size_t WordSize = sizeof(Word) * CHAR_BIT
 

Detailed Description

A contiguous bit vector in which trailing 0s are stripped. Does not shrink - only grows. This isn't a problem for points-to analysis, usually, but may be for other applications.

Implemented as a CBV that has an offset of zero. There is an extremely slight performance penalty in the form of checking if we need to extend backwards. Since the CBV also grows monotonically, this means this BV will always contain a word for 0 till the last ever set bit. TODO: if we change the CBV to shrink, we need to modify this implementation accordingly.

Definition at line 31 of file BitVector.h.

Constructor & Destructor Documentation

◆ BitVector() [1/4]

SVF::BitVector::BitVector ( void  )

Construct empty BV.

Definition at line 17 of file BitVector.cpp.

18  : BitVector(0) { }
BitVector(void)
Construct empty BV.
Definition: BitVector.cpp:17

◆ BitVector() [2/4]

SVF::BitVector::BitVector ( size_t  n)

Construct empty BV with space reserved for n Words.

Definition at line 20 of file BitVector.cpp.

21  : CoreBitVector(n)
22 {
23  // This ensures that leading zeroes are never stripped.
24  set(0);
25  reset(0);
26 }
cJSON * n
Definition: cJSON.cpp:2558
void reset(u32_t bit)
Resets bit in the CBV.
void set(u32_t bit)
Sets bit in the CBV.
CoreBitVector(void)
Construct empty CBV.

◆ BitVector() [3/4]

SVF::BitVector::BitVector ( const BitVector bv)

Copy constructor.

Definition at line 28 of file BitVector.cpp.

29  : CoreBitVector(bv) { }

◆ BitVector() [4/4]

SVF::BitVector::BitVector ( BitVector &&  bv)

Move constructor.

Definition at line 31 of file BitVector.cpp.

32  : CoreBitVector(bv) { }

Member Function Documentation

◆ operator=() [1/2]

BitVector & SVF::BitVector::operator= ( BitVector &&  rhs)

Move assignment.

Definition at line 40 of file BitVector.cpp.

41 {
43  return *this;
44 }
CoreBitVector & operator=(const CoreBitVector &rhs)
Copy assignment.

◆ operator=() [2/2]

BitVector & SVF::BitVector::operator= ( const BitVector rhs)

Copy assignment.

Definition at line 34 of file BitVector.cpp.

35 {
37  return *this;
38 }

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