Remove direct use of UnpinnedArray in Compilation
This commit is contained in:
parent
104f8ef827
commit
3ee62420a3
File diff suppressed because it is too large
Load Diff
@ -218,6 +218,16 @@ pub fn PinnedArray(comptime T: type) type {
|
||||
array.length += count;
|
||||
@memcpy(array.pointer[index..][0..count], items);
|
||||
}
|
||||
|
||||
pub fn insert(array: *@This(), index: u32, item: T) void {
|
||||
assert(index < array.length);
|
||||
array.ensure_capacity(1);
|
||||
const src = array.slice()[index..];
|
||||
array.length += 1;
|
||||
const dst = array.slice()[index + 1..];
|
||||
copy_backwards(T, dst, src);
|
||||
array.slice()[index] = item;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ pub fn main() !void {
|
||||
// assert(arguments.len > 0);
|
||||
// const home_dir = std.posix.getenv("HOME") orelse unreachable;
|
||||
// const timestamp = std.time.milliTimestamp();
|
||||
// var argument_list = UnpinnedArray(u8){};
|
||||
// var argument_list = PinnedArray(u8){};
|
||||
// for (arguments) |arg| {
|
||||
// argument_list.append_slice(context.my_allocator, arg) catch {};
|
||||
// argument_list.append(context.my_allocator, ' ') catch {};
|
||||
|
Loading…
x
Reference in New Issue
Block a user