CPU fix for the cases using a Mask with shift = 0

This commit is contained in:
gdkchan 2018-03-14 01:59:22 -03:00
parent d3ec30ec32
commit bcf4cbf135
2 changed files with 9 additions and 2 deletions

View file

@ -87,8 +87,15 @@ namespace ChocolArm64.Decoder
} }
private static long ShlOnes(long Value, int Shift) private static long ShlOnes(long Value, int Shift)
{
if (Shift != 0)
{ {
return Value << Shift | (long)(ulong.MaxValue >> (64 - Shift)); return Value << Shift | (long)(ulong.MaxValue >> (64 - Shift));
} }
else
{
return Value;
}
}
} }
} }

View file

@ -58,7 +58,7 @@ namespace ChocolArm64.Instruction
int Shift = Op.Imm - (8 << Op.Size); int Shift = Op.Imm - (8 << Op.Size);
ulong Mask = ulong.MaxValue >> (64 - Shift); ulong Mask = Shift != 0 ? ulong.MaxValue >> (64 - Shift) : 0;
for (int Index = 0; Index < (Bytes >> Op.Size); Index++) for (int Index = 0; Index < (Bytes >> Op.Size); Index++)
{ {