0
mirror of https://github.com/sampletext32/ParkanPlayground.git synced 2025-06-20 16:18:37 +03:00

refactor xors

This commit is contained in:
bird_egop
2025-04-13 19:35:28 +03:00
parent 30676b36a1
commit b0ade45f1b
7 changed files with 15 additions and 42 deletions

View File

@ -67,10 +67,8 @@ public class XorImmWithRm32SignExtendedHandler : InstructionHandler
return false;
}
// Read the immediate value and sign-extend it
byte imm8 = Decoder.ReadByte();
// Sign-extend to 32 bits by converting to sbyte first
int imm32 = (int)((sbyte)imm8);
// Read the immediate value and sign-extend it to 32 bits
int imm32 = (sbyte)Decoder.ReadByte();
// Format the immediate value
string immStr;
@ -79,15 +77,10 @@ public class XorImmWithRm32SignExtendedHandler : InstructionHandler
// For negative values, show the full sign-extended 32-bit value
immStr = $"0x{imm32:X8}";
}
else if (imm8 == 0)
{
// For zero, use the expected format
immStr = "0x00";
}
else
{
// For positive values, show without leading zeros
immStr = $"0x{imm8:X}";
immStr = $"0x{imm32:X2}";
}
// Set the operands