From 18a67f3ec99bdb2799f4df45d9488f09ead029eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Wed, 23 Sep 2020 10:47:19 +0200 Subject: [PATCH] Refactor Module --- lib/fizzy/module.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/fizzy/module.hpp b/lib/fizzy/module.hpp index d3d657ea9..3fb9723a7 100644 --- a/lib/fizzy/module.hpp +++ b/lib/fizzy/module.hpp @@ -45,9 +45,14 @@ struct Module // Types of globals defined in import section std::vector imported_global_types; + size_t get_function_count() const noexcept + { + return imported_function_types.size() + funcsec.size(); + } + const FuncType& get_function_type(FuncIdx idx) const noexcept { - assert(idx < imported_function_types.size() + funcsec.size()); + assert(idx < get_function_count()); if (idx < imported_function_types.size()) return imported_function_types[idx]; @@ -58,11 +63,6 @@ struct Module return typesec[type_idx]; } - size_t get_function_count() const noexcept - { - return imported_function_types.size() + funcsec.size(); - } - size_t get_global_count() const noexcept { return imported_global_types.size() + globalsec.size();