-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
If you don't see it on the other fork:
karimcambridge/samp-foreach#10 (comment)
For reference, your Iter_Remove:
Lines 1543 to 1561 in 9cca892
| stock Iter_SafeRemoveInternal(&count, array[], value, &last, size) | |
| { | |
| if (0 <= value < size && array[value] <= size) { | |
| last = size; | |
| new | |
| next = array[last]; | |
| while (next < size) { | |
| if (next == value) { | |
| array[last] = array[value]; | |
| array[value] = size + 1; | |
| --count; | |
| return 1; | |
| } | |
| last = next; | |
| next = array[last]; | |
| } | |
| } | |
| return 0; | |
| } |
My current one:
stock Iter_SafeRemove_InternalC(&count, array[], size, value, &last)
{
if (0 <= value < size++ && array[value] > value)
{
// This version has reverse iterators, which need maintaining, and can
// be used in place of a loop to jump backwards in the list.
return
--count,
last = (array[(value - 1) % size] - 1) % size,
array[last] = array[value],
array[value] = value,
array[(array[last] - 1) % size] = (last + 1) % size;
}
return INVALID_ITERATOR_SLOT;
}(Don't know why it didn't make that link to the other repository in to a nice box).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels