|
@ -8,12 +8,11 @@ |
|
|
|
|
|
|
|
|
void FastCal::fast_cal(uint64_t code) { |
|
|
void FastCal::fast_cal(uint64_t code) { |
|
|
|
|
|
|
|
|
std::cout << RawCode(code).dump_case() << std::endl; |
|
|
// std::cout << RawCode(code).dump_case() << std::endl;
|
|
|
|
|
|
|
|
|
auto core = Core( |
|
|
auto core = Core( |
|
|
[this](auto &&p1, auto &&p2) { |
|
|
[this](auto &&code, auto &&mask) { // lambda as function pointer
|
|
|
// add_new_case(std::forward<decltype(p1)>(p1), std::forward<decltype(p2)>(p2));
|
|
|
add_new_case(std::forward<decltype(code)>(code), std::forward<decltype(mask)>(mask)); |
|
|
add_new_case_demo(std::forward<decltype(p1)>(p1), std::forward<decltype(p2)>(p2)); |
|
|
|
|
|
} |
|
|
} |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
@ -29,10 +28,10 @@ void FastCal::fast_cal(uint64_t code) { |
|
|
|
|
|
|
|
|
while (!cache.empty()) { |
|
|
while (!cache.empty()) { |
|
|
|
|
|
|
|
|
// break check point
|
|
|
/// break check point
|
|
|
|
|
|
|
|
|
if (((cache.front()->code >> (3 * 0xD)) & 0b111) == B_2x2) { |
|
|
if (((cache.front()->code >> (3 * 0xD)) & 0b111) == B_2x2) { |
|
|
std::cout << "Resolved" << std::endl; |
|
|
std::cout << "Resolved" << std::endl; |
|
|
// std::cout << RawCode(cache.front()->code).dump_case() << std::endl;
|
|
|
|
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -67,27 +66,3 @@ void FastCal::add_new_case(uint64_t code, uint64_t mask) { |
|
|
cache.emplace(&cases[code]); |
|
|
cache.emplace(&cases[code]); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void FastCal::add_new_case_demo(Core::cache_t *cache_dat, int cache_size) { |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 1; i < cache_size; ++i) { |
|
|
|
|
|
uint64_t code = cache_dat[i].code; |
|
|
|
|
|
uint64_t mask = cache_dat[i].mask; |
|
|
|
|
|
|
|
|
|
|
|
auto exist_case = cases.find(code); |
|
|
|
|
|
if (exist_case != cases.end()) { |
|
|
|
|
|
exist_case->second.mask |= mask; |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
cases[code] = fast_cal_t { |
|
|
|
|
|
.code = code, |
|
|
|
|
|
.mask = mask, |
|
|
|
|
|
.last = cache.front(), |
|
|
|
|
|
}; |
|
|
|
|
|
cache.emplace(&cases[code]); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|