Fix incorrect Stack growth in push_all

This commit is contained in:
kayomn 2023-05-29 01:36:56 +00:00
parent de82444ac3
commit 5e52fcc795
1 changed files with 2 additions and 2 deletions

View File

@ -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;