fast
This commit is contained in:
parent
9a0c0f77da
commit
47bf8cc0d9
@ -330,20 +330,26 @@ find_row_mask(std::vector<set_t> &sets,
|
|||||||
if (thread_num > 2) { thread_num -= 2; }
|
if (thread_num > 2) { thread_num -= 2; }
|
||||||
for (int i = 0; i < thread_num; ++i) {
|
for (int i = 0; i < thread_num; ++i) {
|
||||||
workers.emplace_back([&] {
|
workers.emplace_back([&] {
|
||||||
|
std::vector<uint64_t> masks;
|
||||||
while (!found) {
|
while (!found) {
|
||||||
uint64_t cur_mask = last_mask;
|
|
||||||
{
|
{
|
||||||
|
masks.clear();
|
||||||
std::lock_guard<std::mutex> _(lock);
|
std::lock_guard<std::mutex> _(lock);
|
||||||
cur_mask = row_mask;
|
for (int i = 0; i < 10000 && row_mask < last_mask; ++i) {
|
||||||
|
masks.push_back(row_mask);
|
||||||
|
row_mask = next_bit_permutation(row_mask);
|
||||||
|
}
|
||||||
if (row_mask >= last_mask) { break; }
|
if (row_mask >= last_mask) { break; }
|
||||||
|
|
||||||
row_mask = next_bit_permutation(row_mask);
|
|
||||||
// verbose_printerr("[LOG] - Cur Row mask: 0x%0lx \t\t bits: %s\n", cur_mask, bit_string(cur_mask));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resolve(cur_mask, found)) {
|
for (const auto &cur_mask : masks) {
|
||||||
std::lock_guard<std::mutex> _(lock);
|
if (resolve(cur_mask, found)) {
|
||||||
if (!found.exchange(true)) { row_mask = cur_mask; }
|
std::lock_guard<std::mutex> _(lock);
|
||||||
|
if (!found.exchange(true)) {
|
||||||
|
row_mask = cur_mask;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user