|
@ -17,8 +17,14 @@ std::queue<fast_cal_t*> cache; |
|
|
|
|
|
|
|
|
std::unordered_map<uint64_t, fast_cal_t> cases; |
|
|
std::unordered_map<uint64_t, fast_cal_t> cases; |
|
|
|
|
|
|
|
|
|
|
|
//bool stop_flag;
|
|
|
|
|
|
|
|
|
void add_new_case(uint64_t code, uint64_t mask) { |
|
|
void add_new_case(uint64_t code, uint64_t mask) { |
|
|
|
|
|
|
|
|
|
|
|
// if (stop_flag) {
|
|
|
|
|
|
// return;
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
auto exist_case = cases.find(code); |
|
|
auto exist_case = cases.find(code); |
|
|
if (exist_case != cases.end()) { // find existed case
|
|
|
if (exist_case != cases.end()) { // find existed case
|
|
|
|
|
|
|
|
@ -30,12 +36,19 @@ void add_new_case(uint64_t code, uint64_t mask) { |
|
|
cases[code] = fast_cal_t { |
|
|
cases[code] = fast_cal_t { |
|
|
.code = code, |
|
|
.code = code, |
|
|
.mask = mask, |
|
|
.mask = mask, |
|
|
|
|
|
// .step = cache.front()->step + 1,
|
|
|
.last = cache.front(), |
|
|
.last = cache.front(), |
|
|
};; |
|
|
};; |
|
|
cache.emplace(&cases[code]); |
|
|
cache.emplace(&cases[code]); |
|
|
|
|
|
|
|
|
// TODO: try to check head address = 0xD at here
|
|
|
// TODO: try to check head address = 0xD at here
|
|
|
|
|
|
|
|
|
|
|
|
// if (((code >> (3 * 0xD)) & 0b111) == B_2x2) {
|
|
|
|
|
|
// std::cout << "Resolved" << std::endl;
|
|
|
|
|
|
// std::cout << RawCode(cache.front()->code).dump_case() << std::endl;
|
|
|
|
|
|
// stop_flag = true;
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
uint32_t fast_cal(uint64_t code) { |
|
|
uint32_t fast_cal(uint64_t code) { |
|
@ -46,21 +59,29 @@ uint32_t fast_cal(uint64_t code) { |
|
|
|
|
|
|
|
|
cache.empty(); |
|
|
cache.empty(); |
|
|
|
|
|
|
|
|
|
|
|
// stop_flag = false;
|
|
|
|
|
|
|
|
|
cases[code] = fast_cal_t { |
|
|
cases[code] = fast_cal_t { |
|
|
.code = code, |
|
|
.code = code, |
|
|
.mask = 0, |
|
|
.mask = 0, |
|
|
|
|
|
// .step = 0,
|
|
|
.last = nullptr, |
|
|
.last = nullptr, |
|
|
}; |
|
|
}; |
|
|
cache.emplace(&cases[code]); |
|
|
cache.emplace(&cases[code]); |
|
|
|
|
|
|
|
|
while (!cache.empty()) { |
|
|
while (!cache.empty()) { |
|
|
|
|
|
|
|
|
|
|
|
// 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;
|
|
|
// std::cout << RawCode(cache.front()->code).dump_case() << std::endl;
|
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// if (stop_flag) {
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
core.next_step(cache.front()->code, cache.front()->mask); |
|
|
core.next_step(cache.front()->code, cache.front()->mask); |
|
|
cache.pop(); |
|
|
cache.pop(); |
|
|
} |
|
|
} |
|
|