mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-28 13:28:01 +03:00
fix missing check on swapped item
This commit is contained in:
parent
519a3b5b79
commit
d7ef5a85dc
1 changed files with 7 additions and 8 deletions
|
@ -390,22 +390,21 @@ namespace rsx
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
for (auto ptr = _data, last = _data + (_size - 1); ptr <= last; ptr++)
|
for (auto last = _data + (_size - 1), ptr = last; ptr >= _data; ptr--)
|
||||||
{
|
{
|
||||||
if (predicate(*ptr))
|
if (predicate(*ptr))
|
||||||
{
|
{
|
||||||
ret = true;
|
ret = true;
|
||||||
|
|
||||||
if (ptr == last)
|
if (ptr != last) // If not last
|
||||||
{
|
{
|
||||||
// Popping the last entry from list. Just set the new size and exit
|
// Move last item into current one
|
||||||
_size--;
|
std::memcpy(ptr, last, sizeof(Ty));
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move item to the end of the list and shrink by 1
|
// Pop last entry from list and set new last item
|
||||||
std::memcpy(ptr, last, sizeof(Ty));
|
_size--;
|
||||||
last = _data + (--_size - 1); // set new last
|
last--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue