From 76db1bb8ff0f42e4527ce42d77b667045697125a Mon Sep 17 00:00:00 2001 From: Ryan Hechenberger Date: Thu, 14 Aug 2025 12:20:07 +1000 Subject: [PATCH 1/4] jump hori/vert loop, masking previous test optimising --- include/jps/jump/jump_point_online.h | 31 +++++++++++++++++++--------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/include/jps/jump/jump_point_online.h b/include/jps/jump/jump_point_online.h index ad466b7..60efcfb 100644 --- a/include/jps/jump/jump_point_online.h +++ b/include/jps/jump/jump_point_online.h @@ -59,17 +59,20 @@ jump_point_online_hori( // order going east is stored as least significant bit to most significant // bit + // first loop gets neis as 8 <= width8_bits < 16 + // other loops will have width8_bits = 7 + std::array neis = nei_slider.get_neighbours_64bit_le(); + // shift above and below 2 points east + // mask out to trav(1) before node location + assert(nei_slider.width8_bits < 16); + uint64_t tmp = East ? ~(~0ull << nei_slider.width8_bits) + : ~(~0ull >> nei_slider.width8_bits); + neis[0] |= tmp; + neis[1] |= tmp; + neis[2] |= tmp; + while(true) { - std::array neis = nei_slider.get_neighbours_64bit_le(); - assert(nei_slider.width8_bits < 16); - uint64_t tmp = East ? ~(~0ull << nei_slider.width8_bits) - : ~(~0ull >> nei_slider.width8_bits); - // shift above and below 2 points east - // mask out to trav(1) before node location - neis[0] |= tmp; - neis[1] |= tmp; - neis[2] |= tmp; // find first jump point, is +1 location past blocker above or below if constexpr(East) { @@ -132,7 +135,15 @@ jump_point_online_hori( // failed, goto next 56 bits jump_count += static_cast(63 - nei_slider.width8_bits); nei_slider.adj_bytes(East ? 7 : -7); - nei_slider.width8_bits = 7; + // nei_slider.width8_bits = 7; + + // get next neis at end of loop + neis = nei_slider.get_neighbours_64bit_le(); + // mask out to trav(1) is not nessesary on loop, as we know it is clear + // constexpr uint64_t neis_mask = East ? ~(~0ull << 7) : ~(~0ull >> 7); + // neis[0] |= neis_mask; + // neis[1] |= neis_mask; + // neis[2] |= neis_mask; } } From 6531cbe8661112ba93080f1adfcc603915ad7233 Mon Sep 17 00:00:00 2001 From: Ryan Hechenberger Date: Thu, 14 Aug 2025 13:35:56 +1000 Subject: [PATCH 2/4] first jump up to 63 bits instead of 55 --- include/jps/jump/jump_point_online.h | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/include/jps/jump/jump_point_online.h b/include/jps/jump/jump_point_online.h index 60efcfb..f534144 100644 --- a/include/jps/jump/jump_point_online.h +++ b/include/jps/jump/jump_point_online.h @@ -47,14 +47,14 @@ jump_point_online_hori( // or high bit to low bit (WEST) auto nei_slider = ::warthog::domain::gridmap_slider::from_bittable(map, pad_id{node}); - nei_slider.adj_bytes( - East ? -1 : -6); // current location is 1 byte from boundrary + if constexpr (!East) { + nei_slider.adj_bytes(-7); // west is opposite side + nei_slider.width8_bits = 7u - nei_slider.width8_bits; + } + assert(nei_slider.width8_bits < 8); // width8_bits is how many bits in on word current node is at, from lsb // EAST and from msb WEST - nei_slider.width8_bits - = East ? nei_slider.width8_bits + 8 : 15 - nei_slider.width8_bits; - // 15 - width8_bits == 63 - (width8_bits + 6 * 8) - jump_distance jump_count = 0; + // 7 - width8_bits == 63 - (width8_bits + 7 * 8) // order going east is stored as least significant bit to most significant // bit @@ -62,15 +62,18 @@ jump_point_online_hori( // first loop gets neis as 8 <= width8_bits < 16 // other loops will have width8_bits = 7 std::array neis = nei_slider.get_neighbours_64bit_le(); + // the rest will only jump 7 // shift above and below 2 points east // mask out to trav(1) before node location - assert(nei_slider.width8_bits < 16); + assert(nei_slider.width8_bits < 8); uint64_t tmp = East ? ~(~0ull << nei_slider.width8_bits) : ~(~0ull >> nei_slider.width8_bits); neis[0] |= tmp; neis[1] |= tmp; neis[2] |= tmp; + jump_distance jump_count = 7u - static_cast(nei_slider.width8_bits); + while(true) { // find first jump point, is +1 location past blocker above or below @@ -98,8 +101,8 @@ jump_point_online_hori( // v is blocker location, prune unless target is present // 10111111 // dead end takes president as jump point can't pass a blocker - jump_count += static_cast(stop_pos) - - static_cast(nei_slider.width8_bits); + // first jump may not skip 7, this is adjusted for on init + jump_count += static_cast(stop_pos) - 7; uint32_t target_jump [[maybe_unused]] = Target ? (East ? target - node : node - target) : 0; // if blocked: pos + jump_count = first block @@ -133,9 +136,9 @@ jump_point_online_hori( } // failed, goto next 56 bits - jump_count += static_cast(63 - nei_slider.width8_bits); + jump_count += static_cast(63 - 7); + nei_slider.width8_bits = 7; nei_slider.adj_bytes(East ? 7 : -7); - // nei_slider.width8_bits = 7; // get next neis at end of loop neis = nei_slider.get_neighbours_64bit_le(); From ec1b14f06b15907ebe51caaf717dc0691f2c1c57 Mon Sep 17 00:00:00 2001 From: Ryan Hechenberger Date: Thu, 14 Aug 2025 14:33:03 +1000 Subject: [PATCH 3/4] removed unnessesary assignment --- include/jps/jump/jump_point_online.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/jps/jump/jump_point_online.h b/include/jps/jump/jump_point_online.h index f534144..2ccc665 100644 --- a/include/jps/jump/jump_point_online.h +++ b/include/jps/jump/jump_point_online.h @@ -137,7 +137,7 @@ jump_point_online_hori( // failed, goto next 56 bits jump_count += static_cast(63 - 7); - nei_slider.width8_bits = 7; + // nei_slider.width8_bits = 7; nei_slider.adj_bytes(East ? 7 : -7); // get next neis at end of loop @@ -177,7 +177,7 @@ jump_point_online_hori_target( if constexpr(!East) { // adjust to last byte for west nei_slider.adj_bytes(-7); - nei_slider.width8_bits = 7 - nei_slider.width8_bits; + nei_slider.width8_bits = 7u - nei_slider.width8_bits; } // order going east is stored as least significant bit to most significant From 06b7fe3ea0347a2374396dce5084c3457c746954 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 14 Aug 2025 04:55:28 +0000 Subject: [PATCH 4/4] auto clang-format action --- include/jps/jump/jump_point_online.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/include/jps/jump/jump_point_online.h b/include/jps/jump/jump_point_online.h index 2ccc665..abcaf21 100644 --- a/include/jps/jump/jump_point_online.h +++ b/include/jps/jump/jump_point_online.h @@ -47,7 +47,8 @@ jump_point_online_hori( // or high bit to low bit (WEST) auto nei_slider = ::warthog::domain::gridmap_slider::from_bittable(map, pad_id{node}); - if constexpr (!East) { + if constexpr(!East) + { nei_slider.adj_bytes(-7); // west is opposite side nei_slider.width8_bits = 7u - nei_slider.width8_bits; } @@ -67,12 +68,13 @@ jump_point_online_hori( // mask out to trav(1) before node location assert(nei_slider.width8_bits < 8); uint64_t tmp = East ? ~(~0ull << nei_slider.width8_bits) - : ~(~0ull >> nei_slider.width8_bits); - neis[0] |= tmp; - neis[1] |= tmp; - neis[2] |= tmp; + : ~(~0ull >> nei_slider.width8_bits); + neis[0] |= tmp; + neis[1] |= tmp; + neis[2] |= tmp; - jump_distance jump_count = 7u - static_cast(nei_slider.width8_bits); + jump_distance jump_count + = 7u - static_cast(nei_slider.width8_bits); while(true) {