mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-28 13:28:01 +03:00
rsx: Fix simple_array<T>::erase_if
This commit is contained in:
parent
fcb6bc70f8
commit
b3bdff741c
1 changed files with 10 additions and 2 deletions
|
@ -390,14 +390,22 @@ namespace rsx
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
for (auto ptr = _data, last = _data + _size - 1; ptr < last; ptr++)
|
for (auto ptr = _data, last = _data + _size - 1; ptr <= last; ptr++)
|
||||||
{
|
{
|
||||||
if (predicate(*ptr))
|
if (predicate(*ptr))
|
||||||
{
|
{
|
||||||
|
ret = true;
|
||||||
|
|
||||||
|
if (ptr == last)
|
||||||
|
{
|
||||||
|
// Popping the last entry from list. Just set the new size and exit
|
||||||
|
_size--;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// Move item to the end of the list and shrink by 1
|
// Move item to the end of the list and shrink by 1
|
||||||
std::memcpy(ptr, last, sizeof(Ty));
|
std::memcpy(ptr, last, sizeof(Ty));
|
||||||
last = _data + (--_size);
|
last = _data + (--_size);
|
||||||
ret = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue