From 5e52fcc79504a649892bc9a66e406885a80bcefa Mon Sep 17 00:00:00 2001 From: kayomn Date: Mon, 29 May 2023 01:36:56 +0000 Subject: [PATCH] Fix incorrect Stack growth in push_all --- source/coral/list.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/coral/list.zig b/source/coral/list.zig index 6cdcba2..b4ef085 100755 --- a/source/coral/list.zig +++ b/source/coral/list.zig @@ -144,7 +144,7 @@ pub fn Stack(comptime Value: type) type { const new_length = self.values.len + values.len; if (new_length >= self.capacity) { - try self.grow(allocator, math.min(new_length, self.capacity)); + try self.grow(allocator, values.len + values.len); } const offset_index = self.values.len; @@ -170,7 +170,7 @@ pub fn Stack(comptime Value: type) type { const new_length = self.values.len + amount; if (new_length >= self.capacity) { - try self.grow(allocator, math.max(usize, new_length, self.capacity)); + try self.grow(allocator, amount + amount); } const offset_index = self.values.len;