PPCRec: Avoid relying on undefined behavior in std::copy_backwards

This commit is contained in:
Exzap 2024-10-30 02:41:43 +01:00
parent a05b6558c4
commit 83569ae66b
1 changed files with 2 additions and 1 deletions

View File

@ -611,7 +611,8 @@ sint32 IMLUtil_MoveInstructionTo(IMLSegment& seg, sint32 initialIndex, sint32 ta
{ {
cemu_assert_debug(targetIndex > 0); cemu_assert_debug(targetIndex > 0);
targetIndex--; targetIndex--;
std::copy_backward(seg.imlList.begin() + initialIndex + 1, seg.imlList.begin() + targetIndex + 1, seg.imlList.begin() + targetIndex); for(size_t i=initialIndex; i<targetIndex; i++)
seg.imlList[i] = seg.imlList[i+1];
seg.imlList[targetIndex] = temp; seg.imlList[targetIndex] = temp;
return targetIndex; return targetIndex;
} }