Merge pull request #118 from birth-software/fix-unspeakable-bug

Fix UnpinnedArray unspeakable bug
This commit is contained in:
David 2024-03-24 09:44:26 -06:00 committed by GitHub
commit c18e41372e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -512,7 +512,7 @@ pub fn UnpinnedArray(comptime T: type) type {
pub fn insert(array: *@This(), allocator: *MyAllocator, index: IndexType, item: T) !void {
assert(index < array.length);
if (array.length + 1 >= array.capacity) {
if (array.length + 1 <= array.capacity) {
const after_count = array.length - index;
copy_backwards(T, array.pointer[index + 1 ..][0..after_count], array.pointer[index..][0..after_count]);
} else {