mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
spec for list append
This commit is contained in:
parent
486f1d540f
commit
13d480d5f3
3 changed files with 7 additions and 2 deletions
|
@ -729,10 +729,13 @@ pub fn listSingle(alignment: u32, element: Opaque, element_width: usize) callcon
|
|||
return output;
|
||||
}
|
||||
|
||||
pub fn listAppend(list: RocList, alignment: u32, element: Opaque, element_width: usize) callconv(.C) RocList {
|
||||
pub fn listAppend(list: RocList, alignment: u32, element: Opaque, element_width: usize, update_mode: UpdateMode) callconv(.C) RocList {
|
||||
const old_length = list.len();
|
||||
var output = list.reallocate(alignment, old_length + 1, element_width);
|
||||
|
||||
// we'd need capacity to use update_mode here
|
||||
_ = update_mode;
|
||||
|
||||
if (output.bytes) |target| {
|
||||
if (element) |source| {
|
||||
@memcpy(target + old_length * element_width, source, element_width);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue