I didn't add a find_prev because I don't need it, although I can without much additional effort. Otherwise, this is pretty self explanatory, just an analogue of find_first() but for searching in reverse.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
(Note that I also added some tests for find_last, and while doing so noticed that there were no tests for find_first(), so I added those too.
llvm/include/llvm/ADT/SparseBitVector.h | ||
---|---|---|
141 ↗ | (On Diff #84707) | Don't you really just want counttrailingzeros, and the index is bitword_size - count trailing zeros? |
llvm/include/llvm/ADT/SparseBitVector.h | ||
---|---|---|
141 ↗ | (On Diff #84707) | I made the same mistake at first. Because the LSB is the bit with the lowest "index", we have to use countLeadingZeros. i.e. 0b00000000000000000000000000000110 has bits 1 and 2 set. The value we want returned from the function is 2. |
llvm/include/llvm/ADT/SparseBitVector.h | ||
---|---|---|
141 ↗ | (On Diff #84707) | This assumes we store these little endian. Anyway, i think you are correct, and if not, the test will fail, so :) |