Add code generation for array
This commit is contained in:
16
codegen/array/snippets/copy_capped
Normal file
16
codegen/array/snippets/copy_capped
Normal file
@@ -0,0 +1,16 @@
|
||||
if (!src || !dst) {{
|
||||
return;
|
||||
}}
|
||||
|
||||
wapp_{Tlower}_array_clear(dst);
|
||||
|
||||
{T} *item;
|
||||
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
||||
for (u64 i = 0; i < to_copy; ++i) {{
|
||||
item = wapp_{Tlower}_array_get(src, i);
|
||||
if (!item) {{
|
||||
continue;
|
||||
}}
|
||||
|
||||
wapp_{Tlower}_array_append_capped(dst, *item);
|
||||
}}
|
Reference in New Issue
Block a user