Browse Source

perf: bfs root aka `cache[0]` static

master
Dnomd343 2 years ago
parent
commit
04b38e897d
  1. 6
      src/core/bfs.h
  2. 4
      src/core/core.cc

6
src/core/bfs.h

@ -3,10 +3,8 @@
#define BFS_INIT \
int next_addr; \
cache_size = 1; \
int current = 0; \
cache[0].filter = 0; \
cache[0].addr = addr; \
cache[0].code = code;
int current = 0; \
cache[0].addr = addr;
#define BFS_LOAD \
code = cache[current].code; \

4
src/core/core.cc

@ -138,7 +138,11 @@ void Core::next_step(uint64_t raw_code, uint64_t mask) { // search next step cas
auto range = raw_code | mask;
cache[0].filter = 0;
cache[0].code = raw_code;
for (int addr = 0; range; addr += 3, range >>= 3) { // traverse every 3-bits
// cache[0].addr = addr;
switch (range & 0b111) { // match low 3-bits
case B_1x1:
move_1x1(raw_code, addr); // try to move 1x1 block

Loading…
Cancel
Save