mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-29 00:59:56 -06:00
remove some UB
- savestates used to read a four bytes from a single byte value - a few unassigned variables - some other things - also make the ROR macro an inline function
This commit is contained in:
@ -110,7 +110,7 @@ OpArg Compiler::A_Comp_GetALUOp2(bool S, bool& carryUsed)
|
||||
Comp_AddCycles_C();
|
||||
|
||||
u32 shift = (CurInstr.Instr >> 7) & 0x1E;
|
||||
u32 imm = ROR(CurInstr.Instr & 0xFF, shift);
|
||||
u32 imm = ::ROR(CurInstr.Instr & 0xFF, shift);
|
||||
|
||||
carryUsed = false;
|
||||
if (S && shift)
|
||||
@ -493,7 +493,7 @@ OpArg Compiler::Comp_RegShiftReg(int op, Gen::OpArg rs, Gen::OpArg rm, bool S, b
|
||||
{
|
||||
if (S)
|
||||
BT(32, R(RSCRATCH), Imm8(31));
|
||||
ROR_(32, R(RSCRATCH), R(ECX));
|
||||
ROR(32, R(RSCRATCH), R(ECX));
|
||||
if (S)
|
||||
SETcc(CC_C, R(RSCRATCH2));
|
||||
}
|
||||
@ -555,7 +555,7 @@ OpArg Compiler::Comp_RegShiftImm(int op, int amount, OpArg rm, bool S, bool& car
|
||||
case 3: // ROR
|
||||
MOV(32, R(RSCRATCH), rm);
|
||||
if (amount > 0)
|
||||
ROR_(32, R(RSCRATCH), Imm8(amount));
|
||||
ROR(32, R(RSCRATCH), Imm8(amount));
|
||||
else
|
||||
{
|
||||
BT(32, R(RCPSR), Imm8(29));
|
||||
|
@ -106,7 +106,7 @@ void Compiler::A_Comp_MSR()
|
||||
Comp_AddCycles_C();
|
||||
|
||||
OpArg val = CurInstr.Instr & (1 << 25)
|
||||
? Imm32(ROR((CurInstr.Instr & 0xFF), ((CurInstr.Instr >> 7) & 0x1E)))
|
||||
? Imm32(::ROR((CurInstr.Instr & 0xFF), ((CurInstr.Instr >> 7) & 0x1E)))
|
||||
: MapReg(CurInstr.A_Reg(0));
|
||||
|
||||
u32 mask = 0;
|
||||
|
@ -73,7 +73,7 @@ bool Compiler::Comp_MemLoadLiteral(int size, bool signExtend, int rd, u32 addr)
|
||||
if (size == 32)
|
||||
{
|
||||
CurCPU->DataRead32(addr & ~0x3, &val);
|
||||
val = ROR(val, (addr & 0x3) << 3);
|
||||
val = ::ROR(val, (addr & 0x3) << 3);
|
||||
}
|
||||
else if (size == 16)
|
||||
{
|
||||
@ -225,13 +225,13 @@ void Compiler::Comp_MemAccess(int rd, int rn, const Op2& op2, int size, int flag
|
||||
if (addrIsStatic)
|
||||
{
|
||||
if (staticAddress & 0x3)
|
||||
ROR_(32, rdMapped, Imm8((staticAddress & 0x3) * 8));
|
||||
ROR(32, rdMapped, Imm8((staticAddress & 0x3) * 8));
|
||||
}
|
||||
else
|
||||
{
|
||||
AND(32, R(RSCRATCH3), Imm8(0x3));
|
||||
SHL(32, R(RSCRATCH3), Imm8(3));
|
||||
ROR_(32, rdMapped, R(RSCRATCH3));
|
||||
ROR(32, rdMapped, R(RSCRATCH3));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -270,7 +270,7 @@ void Compiler::Comp_MemAccess(int rd, int rn, const Op2& op2, int size, int flag
|
||||
{
|
||||
MOV(32, rdMapped, R(RSCRATCH));
|
||||
if (staticAddress & 0x3)
|
||||
ROR_(32, rdMapped, Imm8((staticAddress & 0x3) * 8));
|
||||
ROR(32, rdMapped, Imm8((staticAddress & 0x3) * 8));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user