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