Skip to content

Commit

Permalink
Simplify COUNT_UNSET_BIT() macro
Browse files Browse the repository at this point in the history
  • Loading branch information
kimwalisch committed Dec 5, 2022
1 parent e564959 commit 4bdd8f4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
8 changes: 3 additions & 5 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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.
Expand Down
7 changes: 3 additions & 4 deletions src/Sieve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4bdd8f4

Please sign in to comment.