From 04da85c88aa2280eeb6ab4a4ebede8bb34753204 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Thu, 26 Aug 2021 12:11:54 +0200 Subject: [PATCH] storage: avoid invoking ::page more than once in a row --- src/entt/entity/storage.hpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/entt/entity/storage.hpp b/src/entt/entity/storage.hpp index c2bea0de2..3fcaf5187 100644 --- a/src/entt/entity/storage.hpp +++ b/src/entt/entity/storage.hpp @@ -197,8 +197,10 @@ class basic_storage: public basic_sparse_set value_type & emplace(const entity_type entt, Args &&... args) { const auto pos = base_type::slot(); - assure_at_least(pos); - - alloc_pointer elem = packed[page(pos)] + offset(pos); + alloc_pointer elem = assure_at_least(pos) + offset(pos); construct(elem, std::forward(args)...); ENTT_TRY {