Browse Source

feat: try shared variable in Core

master
Dnomd343 2 years ago
parent
commit
d00d4cd450
  1. 6
      src/core/core.cc
  2. 11
      src/core/core.h
  3. 5
      src/main.cc

6
src/core/core.cc

@ -131,6 +131,8 @@ void Core::move_2x2(uint64_t code, int addr) { // try to move target 2x2 block
void Core::next_step(uint64_t raw_code) {
auto temp_code = raw_code;
// uint64_t raw_code = _code;
for (int addr = 0; temp_code; addr += 3, temp_code >>= 3) {
switch (temp_code & 0b111) {
@ -151,8 +153,8 @@ void Core::next_step(uint64_t raw_code) {
}
if (cache_size != 1) {
for (int i = 1; i < cache_size; ++i) {
std::cout << RawCode(cache[i].code).dump_case();
printf("MASK -> %016lX\n", cache[i].mask);
// std::cout << RawCode(cache[i].code).dump_case();
// printf("(%016lX)\n\n", cache[i].mask);
}
// std::cout << "found: " << cache_size - 1 << std::endl;
}

11
src/core/core.h

@ -36,8 +36,19 @@ public:
void move_2x1(uint64_t code, int addr);
void move_2x2(uint64_t code, int addr);
// void move_1x1(int addr);
// void move_1x2(int addr);
// void move_2x1(int addr);
// void move_2x2(int addr);
void next_step(uint64_t raw_code);
// void next_step();
// uint64_t _code;
// Core(uint64_t raw_code) : _code(raw_code) {}
};

5
src/main.cc

@ -147,9 +147,10 @@ int main() {
auto raw_code = RawCode(CommonCode("4fea134")).unwrap();
auto c = Core();
// for (int i = 0; i < 100000000; ++i) {
// auto c = Core(raw_code);
for (int i = 0; i < 100000000; ++i) {
c.next_step(raw_code);
// }
}
return 0;
}

Loading…
Cancel
Save