Browse Source

feat: support src cases record

master
Dnomd343 2 years ago
parent
commit
b144e16507
  1. 13
      src/analyse/analyse.cc
  2. 6
      src/analyse/analyse.h

13
src/analyse/analyse.cc

@ -23,8 +23,12 @@ void Analyse::start_analyse(uint64_t code) {
cache.emplace(&cases.emplace(code, analyse_t {
.code = code,
.mask = 0,
.step = 0,
.src = std::move(std::set<analyse_t*>{}),
}).first->second);
// std::cout << "src size: " << cases[code].src.size() << std::endl;
while (!cache.empty()) {
core.next_step(cache.front()->code, cache.front()->mask);
@ -39,11 +43,20 @@ void Analyse::new_case(uint64_t code, uint64_t mask) {
auto current = cases.find(code);
if (current != cases.end()) { // find existed case
current->second.mask |= mask; // update mask info
// current->second.src.emplace()
if (current->second.step != cache.front()->step) {
current->second.src.emplace(cache.front());
}
return;
}
cache.emplace(&cases.emplace(code, analyse_t {
.code = code,
.mask = mask,
.step = cache.front()->step + 1,
.src = std::move(std::set<analyse_t*>{cache.front()}),
}).first->second);
}

6
src/analyse/analyse.h

@ -4,15 +4,19 @@
#include <cstdint>
#include <unordered_map>
#include <set>
#include <list>
class Analyse {
public:
struct analyse_t {
uint64_t code;
uint64_t mask;
// int step;
int step;
// TODO: try set / unordered_set
// std::list<analyse_t*> src;
std::set<analyse_t*> src;
};
std::queue<analyse_t*> cache;

Loading…
Cancel
Save