mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-10 20:33:15 +00:00
Fix the previous bug a slightly different way (by modifying how find_next works)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42613 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9d03724c8c
commit
08bb699843
@ -168,15 +168,14 @@ public:
|
|||||||
assert(0 && "Illegal empty element");
|
assert(0 && "Illegal empty element");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// find_next - Returns the index of the next set bit following the
|
/// find_next - Returns the index of the next set bit starting from the
|
||||||
/// "Prev" bit. Returns -1 if the next set bit is not found.
|
/// "Curr" bit. Returns -1 if the next set bit is not found.
|
||||||
int find_next(unsigned Prev) const {
|
int find_next(unsigned Curr) const {
|
||||||
++Prev;
|
if (Curr >= BITS_PER_ELEMENT)
|
||||||
if (Prev >= BITS_PER_ELEMENT)
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
unsigned WordPos = Prev / BITWORD_SIZE;
|
unsigned WordPos = Curr / BITWORD_SIZE;
|
||||||
unsigned BitPos = Prev % BITWORD_SIZE;
|
unsigned BitPos = Curr % BITWORD_SIZE;
|
||||||
BitWord Copy = Bits[WordPos];
|
BitWord Copy = Bits[WordPos];
|
||||||
assert (WordPos <= BITWORDS_PER_ELEMENT
|
assert (WordPos <= BITWORDS_PER_ELEMENT
|
||||||
&& "Word Position outside of element");
|
&& "Word Position outside of element");
|
||||||
@ -390,7 +389,7 @@ class SparseBitVector {
|
|||||||
|
|
||||||
// See if we ran out of Bits in this word.
|
// See if we ran out of Bits in this word.
|
||||||
if (!Bits) {
|
if (!Bits) {
|
||||||
int NextSetBitNumber = Iter->find_next((BitNumber - 1) % ElementSize) ;
|
int NextSetBitNumber = Iter->find_next(BitNumber % ElementSize) ;
|
||||||
// If we ran out of set bits in this element, move to next element.
|
// If we ran out of set bits in this element, move to next element.
|
||||||
if (NextSetBitNumber == -1 || (BitNumber % ElementSize == 0)) {
|
if (NextSetBitNumber == -1 || (BitNumber % ElementSize == 0)) {
|
||||||
++Iter;
|
++Iter;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user