|
LLVM 24.0.0git
|
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 43 of file SparseBitVector.h.
| using llvm::SparseBitVectorElement< ElementSize >::BitWord = unsigned long |
Definition at line 45 of file SparseBitVector.h.
| using llvm::SparseBitVectorElement< ElementSize >::size_type = unsigned |
Definition at line 46 of file SparseBitVector.h.
| anonymous enum |
| Enumerator | |
|---|---|
| BITWORD_SIZE | |
| BITWORDS_PER_ELEMENT | |
| BITS_PER_ELEMENT | |
Definition at line 47 of file SparseBitVector.h.
|
inlineexplicit |
Definition at line 64 of file SparseBitVector.h.
References BITWORDS_PER_ELEMENT.
|
inline |
Definition at line 121 of file SparseBitVector.h.
References llvm::popcount().
|
inline |
Definition at line 93 of file SparseBitVector.h.
References BITWORDS_PER_ELEMENT.
|
inline |
find_first - Returns the index of the first set bit.
Definition at line 129 of file SparseBitVector.h.
References BITWORD_SIZE, BITWORDS_PER_ELEMENT, llvm::countr_zero(), and llvm_unreachable.
|
inline |
find_last - Returns the index of the last set bit.
Definition at line 137 of file SparseBitVector.h.
References BITWORD_SIZE, BITWORDS_PER_ELEMENT, llvm::countl_zero(), I, and llvm_unreachable.
|
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 149 of file SparseBitVector.h.
References assert(), BITS_PER_ELEMENT, BITWORD_SIZE, BITWORDS_PER_ELEMENT, and llvm::countr_zero().
|
inline |
Definition at line 89 of file SparseBitVector.h.
|
inline |
Definition at line 186 of file SparseBitVector.h.
References BITWORDS_PER_ELEMENT, and RHS.
|
inline |
Definition at line 196 of file SparseBitVector.h.
References BITWORDS_PER_ELEMENT, and RHS.
|
inline |
Definition at line 219 of file SparseBitVector.h.
References BITWORDS_PER_ELEMENT, and RHS.
|
inline |
Definition at line 241 of file SparseBitVector.h.
References BITWORDS_PER_ELEMENT.
|
inline |
Definition at line 79 of file SparseBitVector.h.
References RHS.
|
inline |
Definition at line 70 of file SparseBitVector.h.
References BITWORDS_PER_ELEMENT, and RHS.
|
inline |
Definition at line 113 of file SparseBitVector.h.
References BITWORD_SIZE.
|
inline |
Definition at line 100 of file SparseBitVector.h.
References BITWORD_SIZE.
Referenced by test_and_set().
|
inline |
Definition at line 117 of file SparseBitVector.h.
References BITWORD_SIZE.
|
inline |
Definition at line 104 of file SparseBitVector.h.
|
inline |
Definition at line 173 of file SparseBitVector.h.
References BITWORDS_PER_ELEMENT, and RHS.
|
inline |
Definition at line 84 of file SparseBitVector.h.
References assert(), and BITWORDS_PER_ELEMENT.