feat: update
This commit is contained in:
parent
47bf8cc0d9
commit
b6aaf20a3f
@ -320,6 +320,7 @@ find_row_mask(std::vector<set_t> &sets,
|
||||
|
||||
std::atomic_bool found{false};
|
||||
std::mutex lock;
|
||||
const uint64_t step = 10000;
|
||||
|
||||
// while (row_mask < last_mask) {
|
||||
// row_mask = next_bit_permutation(row_mask);
|
||||
@ -330,19 +331,18 @@ find_row_mask(std::vector<set_t> &sets,
|
||||
if (thread_num > 2) { thread_num -= 2; }
|
||||
for (int i = 0; i < thread_num; ++i) {
|
||||
workers.emplace_back([&] {
|
||||
std::vector<uint64_t> masks;
|
||||
while (!found) {
|
||||
uint64_t cur_mask = last_mask;
|
||||
{
|
||||
masks.clear();
|
||||
std::lock_guard<std::mutex> _(lock);
|
||||
for (int i = 0; i < 10000 && row_mask < last_mask; ++i) {
|
||||
masks.push_back(row_mask);
|
||||
if (row_mask >= last_mask) { break; }
|
||||
cur_mask = row_mask;
|
||||
for (int i = 0; i < step && row_mask < last_mask; ++i) {
|
||||
row_mask = next_bit_permutation(row_mask);
|
||||
}
|
||||
if (row_mask >= last_mask) { break; }
|
||||
}
|
||||
|
||||
for (const auto &cur_mask : masks) {
|
||||
for (int i = 0; i < step && cur_mask < last_mask; ++i) {
|
||||
if (resolve(cur_mask, found)) {
|
||||
std::lock_guard<std::mutex> _(lock);
|
||||
if (!found.exchange(true)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user