|
LLVM
10.0.0
|
SparseBitVector is an implementation of a bitvector that is sparse by only storing the elements that have non-zero bits set. More...
#include "llvm/ADT/SparseBitVector.h"
Public Types | |
| enum | { BITWORD_SIZE = sizeof(BitWord) * CHAR_BIT, BITWORDS_PER_ELEMENT = (ElementSize + BITWORD_SIZE - 1) / BITWORD_SIZE, BITS_PER_ELEMENT = ElementSize } |
| using | BitWord = unsigned long |
| using | size_type = unsigned |
SparseBitVector is an implementation of a bitvector that is sparse by only storing the elements that have non-zero bits set.
In order to make this fast for the most common cases, SparseBitVector is implemented as a linked list of SparseBitVectorElements. We maintain a pointer to the last SparseBitVectorElement accessed (in the form of a list iterator), in order to make multiple in-order test/set constant time after the first one is executed. Note that using vectors to store SparseBitVectorElement's does not work out very well because it causes insertion in the middle to take enormous amounts of time with a large amount of bits. Other structures that have better worst cases for insertion in the middle (various balanced trees, etc) do not perform as well in practice as a linked list with this iterator kept up to date. They are also significantly more memory intensive.
Definition at line 41 of file SparseBitVector.h.
| using llvm::SparseBitVectorElement< ElementSize >::BitWord = unsigned long |
Definition at line 43 of file SparseBitVector.h.
| using llvm::SparseBitVectorElement< ElementSize >::size_type = unsigned |
Definition at line 44 of file SparseBitVector.h.
| anonymous enum |
| Enumerator | |
|---|---|
| BITWORD_SIZE | |
| BITWORDS_PER_ELEMENT | |
| BITS_PER_ELEMENT | |
Definition at line 45 of file SparseBitVector.h.
|
inlineexplicit |
Definition at line 62 of file SparseBitVector.h.
References llvm::SparseBitVectorElement< ElementSize >::BITWORDS_PER_ELEMENT.
|
inline |
Definition at line 119 of file SparseBitVector.h.
References llvm::SparseBitVectorElement< ElementSize >::BITWORDS_PER_ELEMENT, and llvm::countPopulation().
|
inline |
Definition at line 91 of file SparseBitVector.h.
References llvm::SparseBitVectorElement< ElementSize >::BITWORDS_PER_ELEMENT.
Referenced by llvm::SparseBitVector< ElementSize >::intersectWithComplement().
|
inline |
find_first - Returns the index of the first set bit.
Definition at line 127 of file SparseBitVector.h.
References llvm::SparseBitVectorElement< ElementSize >::BITWORD_SIZE, llvm::SparseBitVectorElement< ElementSize >::BITWORDS_PER_ELEMENT, llvm::countTrailingZeros(), and llvm_unreachable.
Referenced by llvm::SparseBitVector< ElementSize >::find_first().
|
inline |
find_last - Returns the index of the last set bit.
Definition at line 135 of file SparseBitVector.h.
References llvm::SparseBitVectorElement< ElementSize >::BITWORD_SIZE, llvm::SparseBitVectorElement< ElementSize >::BITWORDS_PER_ELEMENT, llvm::countLeadingZeros(), I, and llvm_unreachable.
Referenced by llvm::SparseBitVector< ElementSize >::find_last().
|
inline |
find_next - Returns the index of the next set bit starting from the "Curr" bit.
Returns -1 if the next set bit is not found.
Definition at line 147 of file SparseBitVector.h.
References assert(), llvm::SparseBitVectorElement< ElementSize >::BITS_PER_ELEMENT, llvm::SparseBitVectorElement< ElementSize >::BITWORD_SIZE, llvm::SparseBitVectorElement< ElementSize >::BITWORDS_PER_ELEMENT, and llvm::countTrailingZeros().
|
inline |
Definition at line 87 of file SparseBitVector.h.
Referenced by llvm::SparseBitVector< ElementSize >::find_first(), and llvm::SparseBitVector< ElementSize >::find_last().
|
inline |
Definition at line 184 of file SparseBitVector.h.
References llvm::SparseBitVectorElement< ElementSize >::BITWORDS_PER_ELEMENT.
Referenced by llvm::SparseBitVector< ElementSize >::intersects().
|
inline |
Definition at line 194 of file SparseBitVector.h.
References llvm::SparseBitVectorElement< ElementSize >::BITWORDS_PER_ELEMENT.
|
inline |
Definition at line 217 of file SparseBitVector.h.
References llvm::SparseBitVectorElement< ElementSize >::BITWORDS_PER_ELEMENT.
Referenced by llvm::SparseBitVector< ElementSize >::intersectWithComplement().
|
inline |
Definition at line 239 of file SparseBitVector.h.
References llvm::SparseBitVectorElement< ElementSize >::BITWORDS_PER_ELEMENT.
|
inline |
Definition at line 77 of file SparseBitVector.h.
|
inline |
Definition at line 68 of file SparseBitVector.h.
References llvm::SparseBitVectorElement< ElementSize >::BITWORDS_PER_ELEMENT.
|
inline |
Definition at line 111 of file SparseBitVector.h.
References llvm::SparseBitVectorElement< ElementSize >::BITWORD_SIZE.
|
inline |
Definition at line 98 of file SparseBitVector.h.
References llvm::SparseBitVectorElement< ElementSize >::BITWORD_SIZE.
|
inline |
Definition at line 115 of file SparseBitVector.h.
References llvm::SparseBitVectorElement< ElementSize >::BITWORD_SIZE.
Referenced by llvm::SparseBitVectorElement< ElementSize >::test_and_set(), and llvm::SparseBitVector< ElementSize >::test_and_set().
|
inline |
Definition at line 102 of file SparseBitVector.h.
References llvm::SparseBitVectorElement< ElementSize >::test().
|
inline |
Definition at line 171 of file SparseBitVector.h.
References llvm::SparseBitVectorElement< ElementSize >::BITWORDS_PER_ELEMENT.
|
inline |
Definition at line 82 of file SparseBitVector.h.
References assert(), and llvm::SparseBitVectorElement< ElementSize >::BITWORDS_PER_ELEMENT.
1.8.13