From d00d4cd45085bc86d97ea0a7c0cdb5f4f3e388dd Mon Sep 17 00:00:00 2001 From: Dnomd343 Date: Wed, 11 Jan 2023 01:36:57 +0800 Subject: [PATCH] feat: try shared variable in Core --- src/core/core.cc | 6 ++++-- src/core/core.h | 11 +++++++++++ src/main.cc | 5 +++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/core/core.cc b/src/core/core.cc index 35b4bd6..18defa1 100644 --- a/src/core/core.cc +++ b/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; } diff --git a/src/core/core.h b/src/core/core.h index 7341bdf..a400e69 100644 --- a/src/core/core.h +++ b/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) {} + }; diff --git a/src/main.cc b/src/main.cc index 5c47f61..812f3c0 100644 --- a/src/main.cc +++ b/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; }