aboutsummaryrefslogtreecommitdiff
path: root/stdlib/tables.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-12-22 16:09:55 -0500
committerBruce Hill <bruce@bruce-hill.com>2024-12-22 16:09:55 -0500
commita9fe674446b4c3a3acf15835cc157bad723363ee (patch)
tree89263b43ccf5c6c18ced6c16df2479811ddd2e16 /stdlib/tables.c
parent5df498fc20e923f4ff90c4c8d43ff77da2e5536f (diff)
Fix for resizing
Diffstat (limited to 'stdlib/tables.c')
-rw-r--r--stdlib/tables.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/stdlib/tables.c b/stdlib/tables.c
index 0ceb948f..df42ef62 100644
--- a/stdlib/tables.c
+++ b/stdlib/tables.c
@@ -252,7 +252,7 @@ public void *Table$reserve(Table_t *t, const void *key, const void *value, const
// Resize buckets if necessary
if (t->entries.length >= (int64_t)t->bucket_info->count) {
// Current resize policy: +50% at a time:
- uint32_t newsize = (3*(uint32_t)t->bucket_info->count)/2;
+ uint32_t newsize = MAX(8, (uint32_t)(3*t->bucket_info->count)/2);
if (unlikely(newsize > TABLE_MAX_BUCKETS))
newsize = TABLE_MAX_BUCKETS;
hashmap_resize_buckets(t, newsize, type);