Archived
1
0
Fork 0
forked from Mirror/Ryujinx
This repository has been archived on 2024-10-11. You can view files and clone it, but cannot push or open issues or pull requests.
jinx/ARMeilleure/Decoders/OpCodeAluImm.cs
gdkchan 2f16491712
Get rid of Reflection.Emit dependency on CPU and Shader projects (#1626)
* Get rid of Reflection.Emit dependency on CPU and Shader projects

* Remove useless private sets

* Missed those due to the alignment
2020-10-21 09:13:44 -03:00

40 lines
No EOL
1.1 KiB
C#

using System;
namespace ARMeilleure.Decoders
{
class OpCodeAluImm : OpCodeAlu, IOpCodeAluImm
{
public long Immediate { get; }
public new static OpCode Create(InstDescriptor inst, ulong address, int opCode) => new OpCodeAluImm(inst, address, opCode);
public OpCodeAluImm(InstDescriptor inst, ulong address, int opCode) : base(inst, address, opCode)
{
if (DataOp == DataOp.Arithmetic)
{
Immediate = (opCode >> 10) & 0xfff;
int shift = (opCode >> 22) & 3;
Immediate <<= shift * 12;
}
else if (DataOp == DataOp.Logical)
{
var bm = DecoderHelper.DecodeBitMask(opCode, true);
if (bm.IsUndefined)
{
Instruction = InstDescriptor.Undefined;
return;
}
Immediate = bm.WMask;
}
else
{
throw new ArgumentException(nameof(opCode));
}
}
}
}