From 164fad98079a4325a06356cf7af8e443c07ffbb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Wed, 7 Feb 2024 16:01:20 +0100 Subject: [PATCH] final tuning --- test/state/mpt.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/test/state/mpt.cpp b/test/state/mpt.cpp index c3ceab6c0..489d0ca44 100644 --- a/test/state/mpt.cpp +++ b/test/state/mpt.cpp @@ -76,20 +76,18 @@ class Path /// The MPT Node. class MPTNode { - static constexpr size_t num_children = 16; - Kind m_kind = Kind::leaf; Path m_path; bytes m_value; - std::unique_ptr m_children[num_children]; + std::unique_ptr m_children[16]; /// Creates a branch node out of two children and an optional extended path. MPTNode(const Path& path, size_t idx1, MPTNode&& child1, size_t idx2, MPTNode&& child2) noexcept : m_kind{Kind::branch}, m_path{path} { assert(idx1 != idx2); - assert(idx1 < num_children); - assert(idx2 < num_children); + assert(idx1 < std::size(m_children)); + assert(idx2 < std::size(m_children)); m_children[idx1] = std::make_unique(std::move(child1)); m_children[idx2] = std::make_unique(std::move(child2)); @@ -195,7 +193,7 @@ MPT::~MPT() noexcept = default; void MPT::insert(bytes_view key, bytes&& value) { - assert(key.size() <= Path::capacity() / 2); // must fit the path impl. length limit + assert(key.size() <= Path::capacity() / 2); // must fit the path implementation length limit const Path path{key}; if (m_root == nullptr)