From 447da11d59aff3cbf655c0f11b032871033a3e93 Mon Sep 17 00:00:00 2001 From: Andrew Noyes Date: Sat, 29 Jun 2024 22:47:42 -0700 Subject: [PATCH] Remove obsolete optimizations These are a relic of when we used forEachInRange for checkMaxBetween --- ConflictSet.cpp | 52 ++++++++++++++++--------------------------------- 1 file changed, 17 insertions(+), 35 deletions(-) diff --git a/ConflictSet.cpp b/ConflictSet.cpp index 28318ef..ac3df16 100644 --- a/ConflictSet.cpp +++ b/ConflictSet.cpp @@ -145,36 +145,24 @@ struct BitSet { // Check begin partial word if (begin & 63) { uint64_t word = words[begin >> 6] & (uint64_t(-1) << (begin & 63)); - if (std::popcount(word) + (begin & 63) == 64) { - while (begin & 63) { - f(begin++); - } - } else { - while (word) { - uint64_t temp = word & -word; - int index = (begin & ~63) + std::countr_zero(word); - f(index); - word ^= temp; - } - begin &= ~63; - begin += 64; + while (word) { + uint64_t temp = word & -word; + int index = (begin & ~63) + std::countr_zero(word); + f(index); + word ^= temp; } + begin &= ~63; + begin += 64; } // Check inner, full words while (begin != (end & ~63)) { uint64_t word = words[begin >> 6]; - if (word == uint64_t(-1)) { - for (int i = 0; i < 64; ++i) { - f(begin + i); - } - } else { - while (word) { - uint64_t temp = word & -word; - int index = begin + std::countr_zero(word); - f(index); - word ^= temp; - } + while (word) { + uint64_t temp = word & -word; + int index = begin + std::countr_zero(word); + f(index); + word ^= temp; } begin += 64; } @@ -182,17 +170,11 @@ struct BitSet { if (end & 63) { // Check end partial word uint64_t word = words[end >> 6] & ~(uint64_t(-1) << (end & 63)); - if (std::popcount(word) == (end & 63)) { - while (begin < end) { - f(begin++); - } - } else { - while (word) { - uint64_t temp = word & -word; - int index = begin + std::countr_zero(word); - f(index); - word ^= temp; - } + while (word) { + uint64_t temp = word & -word; + int index = begin + std::countr_zero(word); + f(index); + word ^= temp; } } }