From 7f5eb565e13ebca7f8ae77678fe892233d508f5b Mon Sep 17 00:00:00 2001 From: lawnjelly Date: Wed, 25 Sep 2019 07:48:35 +0100 Subject: [PATCH] Improved pool --- lplanes_pool.cpp | 31 ++++++++++++------------------- lplanes_pool.h | 5 +++-- 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/lplanes_pool.cpp b/lplanes_pool.cpp index d06923a..f8a1e25 100644 --- a/lplanes_pool.cpp +++ b/lplanes_pool.cpp @@ -13,36 +13,29 @@ LPlanesPool::LPlanesPool() void LPlanesPool::Reset() { - memset(m_ucTaken, 0, sizeof ( m_ucTaken)); - m_uiCount = 0; + for (int n=0; n= POOL_MAX) + if (!m_uiNumFree) return -1; - // could be done more efficiently .. NYI - for (unsigned int n=0; n m_Planes[ POOL_MAX]; - unsigned char m_ucTaken[POOL_MAX]; - unsigned int m_uiCount; + + uint8_t m_ucFreeList[POOL_MAX]; + uint32_t m_uiNumFree; };