Skip to content

Commit

Permalink
PPCRec: Avoid relying on undefined behavior in std::copy_backwards
Browse files Browse the repository at this point in the history
  • Loading branch information
Exzap committed Oct 30, 2024
1 parent a05b655 commit 83569ae
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Cafe/HW/Espresso/Recompiler/IML/IMLOptimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,8 @@ sint32 IMLUtil_MoveInstructionTo(IMLSegment& seg, sint32 initialIndex, sint32 ta
{
cemu_assert_debug(targetIndex > 0);
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;
return targetIndex;
}
Expand Down

0 comments on commit 83569ae

Please sign in to comment.