Skip to content

Commit 2bcee82

Browse files
committed
unroll sieve210 loop
1 parent f30b344 commit 2bcee82

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cp-algo/math/sieve.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ namespace cp_algo::math {
129129
return wheel;
130130
}
131131

132-
constexpr uint32_t wheel_threshold = 400;
132+
constexpr uint32_t wheel_threshold = 500;
133133
size_t medium_primes_begin;
134134
const auto wheels = []() {
135135
uint32_t product = period * dynamic_bit_array::width;
@@ -187,6 +187,7 @@ namespace cp_algo::math {
187187
template <class BitArray>
188188
void sieve210(BitArray& prime, uint32_t l, uint32_t r, size_t i, int state) {
189189
while (l + step_sum[i] <= r) {
190+
#pragma GCC unroll coprime
190191
for (size_t j = 0; j < coprime; j++) {
191192
prime.reset(l);
192193
l += ord_step[i][state++];

0 commit comments

Comments
 (0)