Fix incorrect Stack growth in push_all
This commit is contained in:
parent
de82444ac3
commit
5e52fcc795
|
@ -144,7 +144,7 @@ pub fn Stack(comptime Value: type) type {
|
||||||
const new_length = self.values.len + values.len;
|
const new_length = self.values.len + values.len;
|
||||||
|
|
||||||
if (new_length >= self.capacity) {
|
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;
|
const offset_index = self.values.len;
|
||||||
|
@ -170,7 +170,7 @@ pub fn Stack(comptime Value: type) type {
|
||||||
const new_length = self.values.len + amount;
|
const new_length = self.values.len + amount;
|
||||||
|
|
||||||
if (new_length >= self.capacity) {
|
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;
|
const offset_index = self.values.len;
|
||||||
|
|
Loading…
Reference in New Issue