From b4b8abd9d8ac2507d088cb12744b0dea70b98121 Mon Sep 17 00:00:00 2001 From: James Cherry Date: Thu, 27 Jan 2022 07:41:17 -0700 Subject: [PATCH] ArrayTable::make Signed-off-by: James Cherry --- include/sta/ArrayTable.hh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/sta/ArrayTable.hh b/include/sta/ArrayTable.hh index 16a53370..9b78ada7 100644 --- a/include/sta/ArrayTable.hh +++ b/include/sta/ArrayTable.hh @@ -116,7 +116,13 @@ ArrayTable::make(uint32_t count, if ((free_idx_ == object_idx_null && free_block_idx_ == block_idx_null) || free_idx_ + count >= block->size()) { - uint32_t size = (count > block_size) ? count : block_size; + uint32_t size = block_size; + if (blocks_size_ == 0 + // First block starts at idx 1. + && count > block_size - 1) + size = count + 1; + else if (count > block_size) + size = count; block = makeBlock(size); } // makeId(free_block_idx_, idx_bits)