From 37ef889689654352d5cc52052f9c1f662db5f846 Mon Sep 17 00:00:00 2001 From: greg7mdp Date: Wed, 23 Oct 2024 13:38:09 -0400 Subject: [PATCH] Make comment more explicit as requested. --- include/eosio/vm/types.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/eosio/vm/types.hpp b/include/eosio/vm/types.hpp index fca7449..d301424 100644 --- a/include/eosio/vm/types.hpp +++ b/include/eosio/vm/types.hpp @@ -338,7 +338,11 @@ namespace eosio { namespace vm { static uint32_t get_imported_functions_size_impl(const Imports& imports) { uint32_t number_of_imports = 0; const auto sz = imports.size(); - const auto data = imports.data(); // to avoid the unnecessary size check since we iterate from 0 to sz + // we don't want to use `imports[i]` or `imports.at(i)` since these do an unnecessary check + // `EOS_VM_ASSERT(i < _size)`. The check is unnecessary since we iterate from `0` to `_size`. + // So get the pointer to the first element and dereference it directly. + // ------------------------------------------------------------------------------------------------ + const auto data = imports.data(); for (uint32_t i = 0; i < sz; i++) { if (data[i].kind == external_kind::Function) number_of_imports++;