From bbe937a0d1d90833d970168fb852a25c4eaaa3a3 Mon Sep 17 00:00:00 2001 From: mckay Date: Tue, 24 Jun 2025 16:20:37 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=B8=BA=20compact=5Fbg=5Fmesh=5Fcoord=5Ft?= =?UTF-8?q?=20=E6=8F=90=E4=BE=9B=20std::hash=20=E7=89=B9=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- network_process/interface/fwd_types.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/network_process/interface/fwd_types.hpp b/network_process/interface/fwd_types.hpp index 94cc6db..ce04a2c 100644 --- a/network_process/interface/fwd_types.hpp +++ b/network_process/interface/fwd_types.hpp @@ -227,6 +227,17 @@ struct hash> { size_t operator()(const pod_key_t& k) const { return XXH3_64bits(&k, sizeof(pod_key_t)); } }; +template <> +struct hash { + using argument_type = compact_bg_mesh_coord_t; + using result_type = size_t; + + result_type operator()(const argument_type& coord) const noexcept { + // 使用 uint64_t 的哈希算法,将 hashed_value 映射为 size_t + return static_cast(std::hash()(coord.hashed_value)); + } +}; + template <> struct equal_to { bool operator()(const vertex_header_t& v1, const vertex_header_t& v2) const -- 2.30.2 From 813bccb6663085288440a384543ba5e8ea312c89 Mon Sep 17 00:00:00 2001 From: mckay Date: Tue, 24 Jun 2025 16:21:38 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E9=97=AE=E9=A2=98:=E6=8F=92=E5=85=A5?= =?UTF-8?q?=E4=BA=86=E4=B8=80=E4=B8=AA=E4=B8=8D=E5=B8=A6=E5=88=86=E9=85=8D?= =?UTF-8?q?=E5=99=A8=E7=9A=84=20std::vector=20=E5=88=B0=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E5=88=86=E9=85=8D=E5=99=A8=E7=9A=84=E5=AE=B9=E5=99=A8=E4=B8=AD?= =?UTF-8?q?=09=E6=94=B9=E4=B8=BA=E6=8F=92=E5=85=A5=20stl=5Fvector=5Fmp{i}?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- network_process/src/process.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/network_process/src/process.cpp b/network_process/src/process.cpp index e7b9964..f1ef44c 100644 --- a/network_process/src/process.cpp +++ b/network_process/src/process.cpp @@ -100,7 +100,7 @@ ISNP_API void build_implicit_network_by_blobtree(const s_settings& if (components.size() == 1) // no nesting problem, each shell is an arrangement cell { arrangement_cells.reserve(shells.size()); - for (uint32_t i = 0; i < shells.size(); ++i) { arrangement_cells.emplace_back(std::vector{i}); } + for (uint32_t i = 0; i < shells.size(); ++i) { arrangement_cells.emplace_back(stl_vector_mp{ i }); } } else { { stl_vector_mp> shell_links{}; -- 2.30.2 From a1572260fb231d0c7f7ea6d95f7972662eda380a Mon Sep 17 00:00:00 2001 From: mckay Date: Tue, 24 Jun 2025 16:22:55 +0800 Subject: [PATCH 3/3] =?UTF-8?q?C++=20=E4=B8=8D=E5=85=81=E8=AE=B8=E7=9B=B4?= =?UTF-8?q?=E6=8E=A5=E5=AF=B9=20std::array=20=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=20static=5Fcast=20=E5=88=B0=20std::array=EF=BC=8C?= =?UTF-8?q?=E5=8D=B3=E4=BD=BF=20T1=20=E5=92=8C=20T2=20=E6=98=AF=E5=8F=AF?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2=E7=B1=BB=E5=9E=8B=E3=80=82=20=E6=94=B9?= =?UTF-8?q?=E6=88=90=E6=98=BE=E5=BC=8F=E5=9C=B0=E6=8A=8A=E6=AF=8F=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=20unsigned=20long=20long=20=E5=85=83=E7=B4=A0?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2=E4=B8=BA=20uint32=5Ft?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- network_process/interface/fwd_types.hpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/network_process/interface/fwd_types.hpp b/network_process/interface/fwd_types.hpp index ce04a2c..949ac11 100644 --- a/network_process/interface/fwd_types.hpp +++ b/network_process/interface/fwd_types.hpp @@ -267,7 +267,12 @@ template struct equal_to> { bool operator()(const pod_key_t& k1, const pod_key_t& k2) const { - return static_cast>(k1) == static_cast>(k2); + std::array a, b; + for (size_t i = 0; i < N; ++i) { + a[i] = static_cast(k1[i]); + b[i] = static_cast(k2[i]); + } + return a == b; } }; } // namespace std \ No newline at end of file -- 2.30.2