提交 1bbe03d2 编写于 作者: D Dan Austin

Refactored unsigned long negations

Replaced two instances of negating an unsigned long, which was
resulting in aborts from unsigned integer sanitization with the
equivalent logical not-add 1.

Bug: 25884483
Change-Id: Ic7498e0af638dcd438ce69803021d3cdc3acd4f6
上级 43772d6e
......@@ -90,13 +90,13 @@ void SparseBitSet::initFromRanges(const uint32_t* ranges, size_t nRanges) {
size_t nElements = (end - (start & ~kElMask) + kElMask) >> kLogBitsPerEl;
if (nElements == 1) {
mBitmaps[index] |= (kElAllOnes >> (start & kElMask)) &
(kElAllOnes << ((-end) & kElMask));
(kElAllOnes << ((~end + 1) & kElMask));
} else {
mBitmaps[index] |= kElAllOnes >> (start & kElMask);
for (size_t j = 1; j < nElements - 1; j++) {
mBitmaps[index + j] = kElAllOnes;
}
mBitmaps[index + nElements - 1] |= kElAllOnes << ((-end) & kElMask);
mBitmaps[index + nElements - 1] |= kElAllOnes << ((~end + 1) & kElMask);
}
for (size_t j = startPage + 1; j < endPage + 1; j++) {
mIndices[j] = (currentPage++) << (kLogValuesPerPage - kLogBitsPerEl);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册