Fix UnpinnedArray unspeakable bug
This commit is contained in:
parent
03f4d6368e
commit
53494373ed
@ -512,7 +512,7 @@ pub fn UnpinnedArray(comptime T: type) type {
|
|||||||
|
|
||||||
pub fn insert(array: *@This(), allocator: *MyAllocator, index: IndexType, item: T) !void {
|
pub fn insert(array: *@This(), allocator: *MyAllocator, index: IndexType, item: T) !void {
|
||||||
assert(index < array.length);
|
assert(index < array.length);
|
||||||
if (array.length + 1 >= array.capacity) {
|
if (array.length + 1 <= array.capacity) {
|
||||||
const after_count = array.length - index;
|
const after_count = array.length - index;
|
||||||
copy_backwards(T, array.pointer[index + 1 ..][0..after_count], array.pointer[index..][0..after_count]);
|
copy_backwards(T, array.pointer[index + 1 ..][0..after_count], array.pointer[index..][0..after_count]);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user