From dae309dd607cc57a63448f4bf56cad8e04822193 Mon Sep 17 00:00:00 2001 From: Carl Woffenden Date: Thu, 15 Jun 2023 09:41:13 +0200 Subject: [PATCH] Up-to-date with fast_obj (1a80602) --- inc/fast_obj.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/inc/fast_obj.h b/inc/fast_obj.h index af76db0..c0cbb95 100644 --- a/inc/fast_obj.h +++ b/inc/fast_obj.h @@ -265,15 +265,14 @@ static void* array_realloc(void* ptr, fastObjUInt n, fastObjUInt b) fastObjUInt sz = array_size(ptr); fastObjUInt nsz = sz + n; fastObjUInt cap = array_capacity(ptr); - fastObjUInt ncap = 3 * cap / 2; + fastObjUInt ncap = cap + cap / 2; fastObjUInt* r; - if (ncap < nsz) ncap = nsz; ncap = (ncap + 15) & ~15u; - r = (fastObjUInt*)(memory_realloc(ptr ? _array_header(ptr) : 0, b * ncap + 2 * sizeof(fastObjUInt))); + r = (fastObjUInt*)(memory_realloc(ptr ? _array_header(ptr) : 0, (size_t)b * ncap + 2 * sizeof(fastObjUInt))); if (!r) return 0;