clay/generator/array_remove_swapback.template.c
2024-08-23 16:11:56 +12:00

9 lines
293 B
C

$TYPE$ $NAME$_RemoveSwapback($NAME$ *array, int index) {
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$;
}