MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / grow_at

Method grow_at

cranelift/entity/src/list.rs:633–640  ·  view source on GitHub ↗

Grow the list by inserting `count` elements at `index`. The new elements are not initialized, they will contain whatever happened to be in memory. Since the memory comes from the pool, this will be either zero entity references or whatever where in a previously deallocated list.

(&mut self, index: usize, count: usize, pool: &mut ListPool<T>)

Source from the content-addressed store, hash-verified

631 /// Since the memory comes from the pool, this will be either zero entity references or
632 /// whatever where in a previously deallocated list.
633 pub fn grow_at(&mut self, index: usize, count: usize, pool: &mut ListPool<T>) {
634 let data = self.grow(count, pool);
635
636 // Copy elements after `index` up.
637 for i in (index + count..data.len()).rev() {
638 data[i] = data[i - count];
639 }
640 }
641}
642
643#[cfg(test)]

Callers 2

copy_fromMethod · 0.80
growingFunction · 0.80

Calls 2

growMethod · 0.45
lenMethod · 0.45

Tested by 1

growingFunction · 0.64