use std::swap 🔃
This commit is contained in:
parent
c23e158312
commit
883fceb6ce
64
src/ARM.cpp
64
src/ARM.cpp
|
@ -17,6 +17,7 @@
|
|||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <algorithm>
|
||||
#include "NDS.h"
|
||||
#include "DSi.h"
|
||||
#include "ARM.h"
|
||||
|
@ -392,74 +393,71 @@ void ARM::RestoreCPSR()
|
|||
|
||||
void ARM::UpdateMode(u32 oldmode, u32 newmode)
|
||||
{
|
||||
u32 temp;
|
||||
#define SWAP(a, b) temp = a; a = b; b = temp;
|
||||
|
||||
if ((oldmode & 0x1F) == (newmode & 0x1F)) return;
|
||||
|
||||
switch (oldmode & 0x1F)
|
||||
{
|
||||
case 0x11:
|
||||
SWAP(R[8], R_FIQ[0]);
|
||||
SWAP(R[9], R_FIQ[1]);
|
||||
SWAP(R[10], R_FIQ[2]);
|
||||
SWAP(R[11], R_FIQ[3]);
|
||||
SWAP(R[12], R_FIQ[4]);
|
||||
SWAP(R[13], R_FIQ[5]);
|
||||
SWAP(R[14], R_FIQ[6]);
|
||||
std::swap(R[8], R_FIQ[0]);
|
||||
std::swap(R[9], R_FIQ[1]);
|
||||
std::swap(R[10], R_FIQ[2]);
|
||||
std::swap(R[11], R_FIQ[3]);
|
||||
std::swap(R[12], R_FIQ[4]);
|
||||
std::swap(R[13], R_FIQ[5]);
|
||||
std::swap(R[14], R_FIQ[6]);
|
||||
break;
|
||||
|
||||
case 0x12:
|
||||
SWAP(R[13], R_IRQ[0]);
|
||||
SWAP(R[14], R_IRQ[1]);
|
||||
std::swap(R[13], R_IRQ[0]);
|
||||
std::swap(R[14], R_IRQ[1]);
|
||||
break;
|
||||
|
||||
case 0x13:
|
||||
SWAP(R[13], R_SVC[0]);
|
||||
SWAP(R[14], R_SVC[1]);
|
||||
std::swap(R[13], R_SVC[0]);
|
||||
std::swap(R[14], R_SVC[1]);
|
||||
break;
|
||||
|
||||
case 0x17:
|
||||
SWAP(R[13], R_ABT[0]);
|
||||
SWAP(R[14], R_ABT[1]);
|
||||
std::swap(R[13], R_ABT[0]);
|
||||
std::swap(R[14], R_ABT[1]);
|
||||
break;
|
||||
|
||||
case 0x1B:
|
||||
SWAP(R[13], R_UND[0]);
|
||||
SWAP(R[14], R_UND[1]);
|
||||
std::swap(R[13], R_UND[0]);
|
||||
std::swap(R[14], R_UND[1]);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (newmode & 0x1F)
|
||||
{
|
||||
case 0x11:
|
||||
SWAP(R[8], R_FIQ[0]);
|
||||
SWAP(R[9], R_FIQ[1]);
|
||||
SWAP(R[10], R_FIQ[2]);
|
||||
SWAP(R[11], R_FIQ[3]);
|
||||
SWAP(R[12], R_FIQ[4]);
|
||||
SWAP(R[13], R_FIQ[5]);
|
||||
SWAP(R[14], R_FIQ[6]);
|
||||
std::swap(R[8], R_FIQ[0]);
|
||||
std::swap(R[9], R_FIQ[1]);
|
||||
std::swap(R[10], R_FIQ[2]);
|
||||
std::swap(R[11], R_FIQ[3]);
|
||||
std::swap(R[12], R_FIQ[4]);
|
||||
std::swap(R[13], R_FIQ[5]);
|
||||
std::swap(R[14], R_FIQ[6]);
|
||||
break;
|
||||
|
||||
case 0x12:
|
||||
SWAP(R[13], R_IRQ[0]);
|
||||
SWAP(R[14], R_IRQ[1]);
|
||||
std::swap(R[13], R_IRQ[0]);
|
||||
std::swap(R[14], R_IRQ[1]);
|
||||
break;
|
||||
|
||||
case 0x13:
|
||||
SWAP(R[13], R_SVC[0]);
|
||||
SWAP(R[14], R_SVC[1]);
|
||||
std::swap(R[13], R_SVC[0]);
|
||||
std::swap(R[14], R_SVC[1]);
|
||||
break;
|
||||
|
||||
case 0x17:
|
||||
SWAP(R[13], R_ABT[0]);
|
||||
SWAP(R[14], R_ABT[1]);
|
||||
std::swap(R[13], R_ABT[0]);
|
||||
std::swap(R[14], R_ABT[1]);
|
||||
break;
|
||||
|
||||
case 0x1B:
|
||||
SWAP(R[13], R_UND[0]);
|
||||
SWAP(R[14], R_UND[1]);
|
||||
std::swap(R[13], R_UND[0]);
|
||||
std::swap(R[14], R_UND[1]);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
#include "GPU3D_Soft.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "NDS.h"
|
||||
|
@ -756,11 +757,10 @@ void SoftRenderer::RenderShadowMaskScanline(RendererPolygon* rp, s32 y)
|
|||
rp->SlopeR.EdgeParams_YMajor(&l_edgelen, &l_edgecov);
|
||||
rp->SlopeL.EdgeParams_YMajor(&r_edgelen, &r_edgecov);
|
||||
|
||||
s32 tmp;
|
||||
tmp = xstart; xstart = xend; xend = tmp;
|
||||
tmp = wl; wl = wr; wr = tmp;
|
||||
tmp = zl; zl = zr; zr = tmp;
|
||||
tmp = (s32)l_filledge; l_filledge = r_filledge; r_filledge = (bool)tmp;
|
||||
std::swap(xstart, xend);
|
||||
std::swap(wl, wr);
|
||||
std::swap(zl, zr);
|
||||
std::swap(l_filledge, r_filledge);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -977,11 +977,10 @@ void SoftRenderer::RenderPolygonScanline(RendererPolygon* rp, s32 y)
|
|||
rp->SlopeR.EdgeParams_YMajor(&l_edgelen, &l_edgecov);
|
||||
rp->SlopeL.EdgeParams_YMajor(&r_edgelen, &r_edgecov);
|
||||
|
||||
s32 tmp;
|
||||
tmp = xstart; xstart = xend; xend = tmp;
|
||||
tmp = wl; wl = wr; wr = tmp;
|
||||
tmp = zl; zl = zr; zr = tmp;
|
||||
tmp = (s32)l_filledge; l_filledge = r_filledge; r_filledge = (bool)tmp;
|
||||
std::swap(xstart, xend);
|
||||
std::swap(wl, wr);
|
||||
std::swap(zl, zr);
|
||||
std::swap(l_filledge, r_filledge);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue