clay/generator/array_remove_swapback.template.c

9 lines
297 B
C
Raw Normal View History

$TYPE$ $NAME$_RemoveSwapback($NAME$ *array, int32_t index) {
2024-08-23 04:05:23 +00:00
if (Clay__Array_RangeCheck(index, array->length)) {
array->length--;
$TYPE$ removed = array->internalArray[index];
array->internalArray[index] = array->internalArray[array->length];
return removed;
}
return $DEFAULT_VALUE$;
}