From 2872815ee7e8d54e79540fa5ca2abab1d6935e10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Thu, 30 Aug 2018 10:20:20 +0200 Subject: [PATCH] [poincare] Inline TreePool::node(identifier) --- poincare/include/poincare/tree_pool.h | 10 +++++++++- poincare/src/tree_pool.cpp | 10 ---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/poincare/include/poincare/tree_pool.h b/poincare/include/poincare/tree_pool.h index 2974c8fe9..752fbf0ad 100644 --- a/poincare/include/poincare/tree_pool.h +++ b/poincare/include/poincare/tree_pool.h @@ -24,7 +24,15 @@ public: static TreePool * sharedPool(); // Node - TreeNode * node(int identifier) const; + TreeNode * node(int identifier) const { + if (identifier <= TreeNode::FirstStaticNodeIdentifier) { + int index = indexOfStaticNode(identifier); + assert(index >= 0 && index < MaxNumberOfStaticNodes); + return m_staticNodes[index]; + } + assert(identifier >= 0 && identifier <= MaxNumberOfNodes); + return m_nodeForIdentifier[identifier]; + } TreeNode * last() const { return reinterpret_cast(const_cast(m_cursor)); } template diff --git a/poincare/src/tree_pool.cpp b/poincare/src/tree_pool.cpp index 916bd5abc..4c331c3a8 100644 --- a/poincare/src/tree_pool.cpp +++ b/poincare/src/tree_pool.cpp @@ -10,16 +10,6 @@ TreePool * TreePool::sharedPool() { return &pool; } -TreeNode * TreePool::node(int identifier) const { - if (identifier <= FirstStaticNodeIdentifier) { - int index = indexOfStaticNode(identifier); - assert(index >= 0 && index < MaxNumberOfStaticNodes); - return m_staticNodes[index]; - } - assert(identifier >= 0 && identifier <= MaxNumberOfNodes); - return m_nodeForIdentifier[identifier]; -} - static void memmove32(uint32_t * dst, uint32_t * src, size_t len) { if (src < dst && dst < src + len) { /* Copy backwards to avoid overwrites */