feat: min step

This commit is contained in:
tqcq 2024-10-26 09:43:53 +00:00
parent 30b8be208b
commit 1845acf65f

View File

@ -332,7 +332,7 @@ find_row_mask(std::vector<set_t> &sets,
if (thread_num > 4) { thread_num -= 4; } if (thread_num > 4) { thread_num -= 4; }
fprintf(stderr, "thread_num: %d\n", thread_num); fprintf(stderr, "thread_num: %d\n", thread_num);
uint64_t step = 1000000; uint64_t step = 1000;
std::atomic<uint64_t> cur_pos{0}; std::atomic<uint64_t> cur_pos{0};
std::atomic<uint64_t> base_pos{0}; std::atomic<uint64_t> base_pos{0};
// for (uint64_t i = row_mask; i < last_mask; ++step) { i = next_bit_permutation(i); } // for (uint64_t i = row_mask; i < last_mask; ++step) { i = next_bit_permutation(i); }
@ -354,7 +354,7 @@ find_row_mask(std::vector<set_t> &sets,
step_count = cur_pos - base_pos; step_count = cur_pos - base_pos;
my_pos = cur_pos.fetch_add(1); my_pos = cur_pos.fetch_add(1);
} }
while (cur_mask < last_mask && step_count > 0) { while (cur_mask < last_mask && step_count > 0 && !found.load(std::memory_order_relaxed)) {
--step_count; --step_count;
for (int i = 0; i < step && cur_mask < last_mask; ++i) { for (int i = 0; i < step && cur_mask < last_mask; ++i) {
cur_mask = next_bit_permutation(cur_mask); cur_mask = next_bit_permutation(cur_mask);