|
@ -10,6 +10,7 @@ struct fast_cal_t { |
|
|
uint64_t code; |
|
|
uint64_t code; |
|
|
uint64_t mask; |
|
|
uint64_t mask; |
|
|
// uint32_t step;
|
|
|
// uint32_t step;
|
|
|
|
|
|
fast_cal_t *last; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
std::queue<fast_cal_t*> cache; |
|
|
std::queue<fast_cal_t*> cache; |
|
@ -29,8 +30,12 @@ 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, |
|
|
|
|
|
.last = cache.front(), |
|
|
};; |
|
|
};; |
|
|
cache.emplace(&cases[code]); |
|
|
cache.emplace(&cases[code]); |
|
|
|
|
|
|
|
|
|
|
|
// TODO: try to check head address = 0xD at here
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
uint32_t fast_cal(uint64_t code) { |
|
|
uint32_t fast_cal(uint64_t code) { |
|
@ -39,17 +44,20 @@ uint32_t fast_cal(uint64_t code) { |
|
|
|
|
|
|
|
|
cases.empty(); |
|
|
cases.empty(); |
|
|
|
|
|
|
|
|
|
|
|
cache.empty(); |
|
|
|
|
|
|
|
|
cases[code] = fast_cal_t { |
|
|
cases[code] = fast_cal_t { |
|
|
.code = code, |
|
|
.code = code, |
|
|
.mask = 0, |
|
|
.mask = 0, |
|
|
|
|
|
.last = nullptr, |
|
|
}; |
|
|
}; |
|
|
cache.emplace(&cases[code]); |
|
|
cache.emplace(&cases[code]); |
|
|
|
|
|
|
|
|
while (!cache.empty()) { |
|
|
while (!cache.empty()) { |
|
|
|
|
|
|
|
|
if (((cache.front()->code >> (3 * 0xD)) & 0b111) == B_2x2) { |
|
|
if (((cache.front()->code >> (3 * 0xD)) & 0b111) == B_2x2) { |
|
|
std::cout << "Resolve" << 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; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -57,6 +65,13 @@ uint32_t fast_cal(uint64_t code) { |
|
|
cache.pop(); |
|
|
cache.pop(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
auto solution = cache.front(); |
|
|
|
|
|
|
|
|
|
|
|
while (solution != nullptr) { |
|
|
|
|
|
std::cout << RawCode(solution->code).dump_case() << std::endl; |
|
|
|
|
|
solution = solution->last; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return cases.size(); |
|
|
return cases.size(); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|