diff --git a/ChangeLog b/ChangeLog index 11674843..314b5c73 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,10 @@ -Changes in primecount-7.5, 2022-11-28 +Changes in primecount-7.5, 2022-12-05 The C/C++ API and ABI of primecount-7.5 are backwards compatible but primecount-7.5 now requires >= libprimesieve.so.11. The previous primecount-7.4 requried >= libprimesieve.so.10. +* Update to the latest libprimesieve-11.0. * phi.cpp: 10% phi(x, a) speedup. * pi_gourdon.cpp: Reduce context switches and cpu migrations by up to 2x. * LoadBalancerP2.cpp: Improve load balancing for high CPU core count servers. @@ -12,10 +13,7 @@ primecount-7.4 requried >= libprimesieve.so.10. * AC.cpp: Improve load balancing for high CPU core count servers. * D.cpp: Improve load balancing for high CPU core count servers. * P3.cpp: Improve load balancing for high CPU core count servers. -* Update to the latest libprimesieve-11.0. -* Use the new primesieve::iterator::jump_to() instead of - primesieve::iterator::skipto(). This reduces the number of required - start number corrections (e.g. skipto(start-1)) by 2x. +* Sieve.cpp: Simplify COUNT_UNSET_BIT() macro. * pod_vector.hpp: Added support for types with destructors. * CMakeLists.txt: Use WITH_DIV32=OFF when using the Clang compiler. * Hard-Special-Leaves.md: Convert formulas to MathJax. diff --git a/src/Sieve.cpp b/src/Sieve.cpp index f38db62b..3c34a9b4 100644 --- a/src/Sieve.cpp +++ b/src/Sieve.cpp @@ -588,11 +588,10 @@ void Sieve::cross_off_count(uint64_t prime, uint64_t i) #define COUNT_UNSET_BIT(bit_index) \ { \ std::size_t sieve_byte = sieve[m]; \ - std::size_t bit = sieve_byte & (1 << bit_index); \ - std::size_t is_bit = bit >> bit_index; \ - sieve[m] = (uint8_t) (sieve_byte - bit); \ + std::size_t is_bit = (sieve_byte >> bit_index) & 1; \ + sieve[m] &= ~(1 << bit_index); \ counter[m >> counter_log2_dist] -= (uint32_t) is_bit; \ - total_count -= is_bit; \ + total_count -= (uint64_t) is_bit; \ } switch (wheel.index)